TODO: cleanup NOTES and KeyCloak stuff
NOTE: project started from
nestjs-oficial-repo/sample/12-graphql-schema-first
$ npm install nest-keycloak-connect --save
peer @nestjs/common@"^7.0.3" from nest-keycloak-connect@1.6.1
$ git clone https://github.com/ferrerojosh/nest-keycloak-connect.gitget project version from starter/package.json, ex 8.0.2
"dependencies": {
"@nestjs/common": "8.0.2",and and replace 7.0.3 in nest-keycloak-connect/package.json
"peerDependencies": {
"@nestjs/common": "^7.0.3",
},
"devDependencies": {
"@nestjs/common": "^7.0.3",
"@nestjs/core": "^7.0.3",
}
}$ rm nest-keycloak-connect/package-lock.json
$ rm starter/package-lock.json
$ cd starter
$ npm i ../nest-keycloak-connect/
$ npm i "dependencies": {
"nest-keycloak-connect": "file:../nest-keycloak-connect",
},donw now we have dependency installed
update all packages to new versions nest-keycloak-connect/package.json
$ cd nest-keycloak-connect
$ npm i
$ cd starter
$ npm inow it build
import {
KeycloakConnectModule,
ResourceGuard,
RoleGuard,
AuthGuard,
PolicyEnforcementMode,
TokenValidation
} from 'nest-keycloak-connect';Cannot find module 'nest-keycloak-connect' or its corresponding type declarations.ts(2307)
$ cd nest-keycloak-connect
$ npm run builddone now we have folder
nest-keycloak-connect/dist
the trick is installing from dist folder with
$ cd starter
$ npm i ../nest-keycloak-connect/distget code from example at nest-keycloak-connect/example/src/app.module.ts
create starter/keycloak.json
{
"realm": "Demo-Realm",
"auth-server-url": "https://auth.koakh.com/auth",
"ssl-required": "external",
"resource": "nest-api",
"verify-token-audience": true,
"credentials": {
"secret": "f2912fae-a536-4685-a477-b59582bee3cb"
},
"confidential-port": 0,
"policy-enforcer": {}
}$ npm run start:debug
[Nest] 9313 - 07/12/2021, 8:19:20 PM LOG [NestFactory] Starting Nest application...
[Nest] 9313 - 07/12/2021, 8:19:20 PM WARN [KeycloakConnectModule] Token validation is disabled, please only do this on development/special use-cases.
[Nest] 9313 - 07/12/2021, 8:19:20 PM ERROR [ExceptionHandler] Nest can\'t resolve dependencies of the ResourceGuard (KEYCLOAK_INSTANCE, KEYCLOAK_CONNECT_OPTIONS, KEYCLOAK_LOGGER, ?). Please make sure that the argument Reflector at index [3] is available in the AppModule context.Potential solutions:
-
If Reflector is a provider, is it part of the current AppModule?
-
If Reflector is exported from a separate @Module, is that module imported within AppModule? @Module({ imports: [ /* the Module containing Reflector */ ] })
-
@AuthenticatedUser in GraphQL Resolver · Issue #57 · ferrerojosh/nest-keycloak-connect
-
Forbidden resource with GraphQL · Issue #38 · ferrerojosh/nest-keycloak-connect
Leave keycloak for now
-
@neo4j/graphql:*- Logs all -
@neo4j/graphql:auth- Logs the status of authorization header and token extraction, and decoding of JWT -
@neo4j/graphql:graphql- Logs the GraphQL query and variables -
@neo4j/graphql:execute- Logs the Cypher and Cypher paramaters before execution, and summary of execution
ex add DEBUG=@neo4j/graphql:auth to debug script