/** * GraphQL Authentication Decorators * * These decorators provide GraphQL-specific authentication and authorization * functionality by extending the base decorators with GraphQL context options. * They maintain the same API as the base decorators but automatically configure * for GraphQL execution context. * * @packageDocumentation */ /** * GraphQL-specific CurrentUser decorator * * Injects the currently authenticated user into GraphQL resolver parameters. * Uses GraphQL context to extract the user object populated by authentication guards. * * @param property - Optional property path to extract from the user object (e.g., 'id', 'profile.name') * @returns Parameter decorator that injects the current user from GraphQL context * * @example * ```ts * @Query(() => IUser, { name: 'GetCurrentUser' }) * async getCurrentUser(@GraphQLCurrentUser() user: IUser): Promise { * return user; * } * ``` * * @example With property access * ```ts * @Query(() => String, { name: 'GetUserId' }) * async getUserId(@GraphQLCurrentUser('id') userId: string): Promise { * return userId; * } * ``` */ export declare function GraphQLCurrentUser(property?: string): ParameterDecorator; /** * GraphQL-specific AuthToken decorator. * * Injects the authorization token from GraphQL request context headers. * Useful for custom token validation in GraphQL resolvers. * * @returns ParameterDecorator that injects the raw authorization token string * * @example * ```ts * @Query(() => Boolean, { name: 'ValidateToken' }) * async validateToken(@GraphQLAuthToken() token: string): Promise { * return this.authService.validateToken(token); * } * ``` */ export declare const GraphQLAuthToken: () => ParameterDecorator; /** * GraphQL Context Parameter decorator * * Injects the entire GraphQL context object into resolver parameters. * Provides access to request, response, and other context data in GraphQL resolvers. * * @returns Parameter decorator that injects the GraphQL context * * @example * ```ts * @Query(() => String, { name: 'GetRequestId' }) * async getRequestId(@GraphQLContextParam() context: Record): Promise { * const req = context.req as Record; * return String(req.headers?.['x-request-id'] ?? ''); * } * ``` */ export declare const GraphQLContextParam: () => ParameterDecorator; /** * GraphQL IUser alias for GraphQLCurrentUser * * Alternative name for GraphQLCurrentUser decorator specifically for GraphQL contexts. * Provides the same functionality with a more explicit name. * * @param property - Optional property path to extract from the user object * @returns Parameter decorator that injects the current user * * @example * ```ts * @Query(() => IUser, { name: 'GetCurrentUser' }) * async getCurrentUser(@GraphQLUser() user: IUser): Promise { * return user; * } * ``` */ export declare const GraphQLUser: typeof GraphQLCurrentUser; /** * GraphQL-specific KeycloakClaims decorator * * Injects the raw Keycloak token claims into GraphQL resolver parameters. * Uses GraphQL context to extract the claims object populated by authentication guards. * Useful for accessing fine-grained claim information in GraphQL resolvers. * * @returns Parameter decorator that injects the Keycloak token claims from GraphQL context * * @example * ```ts * @Query(() => Object, { name: 'GetTokenInfo' }) * async getTokenInfo(@GraphQLKeycloakClaims() claims: IKeycloakTokenClaims): Promise> { * return { issuer: claims.iss, audience: claims.aud }; * } * ``` */ export declare const GraphQLKeycloakClaims: () => ParameterDecorator; //# sourceMappingURL=graphql-auth-decorators.d.ts.map