estoy trabajando en un proyecto de nido y estoy tratando de manejar la autenticación usando keycloack y conecté mi aplicación al servicio keycloack
KeycloakConnectModule.register({ authServerUrl: 'http://localhost:8080/auth', realm: 'demo', clientId: 'nest-app', secret: 'c3e273bc-3286-44a6-bc21-82195718f0fb', // Secret key of the client taken from keycloak server }),y usé los decoradores y funcionaron bien
@Controller() export class UserController { constructor(private readonly userService: UserService) {} @Get('/public') @Unprotected() getpublic(): string { return `${this.userService.getHello()} from public`; } @Get('/user') @Roles('user') getUser(): string { return `${this.userService.getHello()} from user`; } @Get('/admin') @Roles('admin') getAdmin(): string { return `${this.userService.getHello()} from admin`; } @Get('/all') @AllowAnyRole() getAll(): string { return `${this.userService.getHello()} from all`; } }ahora me pregunto cómo iniciar sesión y registrar a un usuario desde el servidor nestjs. Miré y descubrí que puedo inyectar el
constructor( @Inject(KEYCLOAK_INSTANCE) private keycloak: any, ) {}ahora, ¿cómo se supone que debo usar eso porque no hay documentación sobre cómo usar el servicio y no hay autocompletar cuando lo hago?
this.keycloack.login() // for examplepodrías ayudarme por favor ?