UNPKG

@zigatech/keycloak-auth

Version:

Keycloak authorization library for NestJS. Works out of the box.

7 lines (6 loc) 232 B
import { createParamDecorator } from "@nestjs/common"; export const UserID = createParamDecorator((_, ctx) => { const req = ctx.switchToHttp().getRequest(); const principal = req.principal; return principal.getId(); });