@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
60 lines (59 loc) • 1.88 kB
TypeScript
import { BaseAuthProvider } from "./BaseAuthProvider.js";
import type { Auth0Config, AuthHealthCheck, AuthProviderConfig, AuthProviderType, AuthRequestContext, AuthUser, TokenValidationResult } from "../../types/index.js";
/**
* Auth0 Authentication Provider
*
* Supports JWT validation with JWKS for Auth0-issued tokens.
* Uses jose library for JWT verification against Auth0's JWKS endpoint.
*
* Features:
* - JWT validation with JWKS
* - User profile fetching (requires Management API token)
* - Role and permission extraction from token claims
*
* @example
* ```typescript
* const auth0 = new Auth0Provider({
* type: "auth0",
* domain: "your-tenant.auth0.com",
* clientId: "your-client-id",
* audience: "https://your-api.example.com"
* });
*
* const result = await auth0.authenticateToken(bearerToken);
* if (result.valid) {
* console.log("Authenticated user:", result.user);
* }
* ```
*/
export declare class Auth0Provider extends BaseAuthProvider {
readonly type: AuthProviderType;
private domain;
private clientId;
private audience?;
private rolesNamespace?;
private permissionsNamespace?;
private jwks;
constructor(config: AuthProviderConfig & Auth0Config);
/**
* Initialize JWKS for JWT verification
*/
initialize(): Promise<void>;
/**
* Validate Auth0 JWT token
*/
authenticateToken(token: string, _context?: AuthRequestContext): Promise<TokenValidationResult>;
/**
* Fetch user profile from Auth0 Management API
* Note: Requires AUTH0_MANAGEMENT_TOKEN environment variable
*/
getUser(userId: string): Promise<AuthUser | null>;
/**
* Get user by email from Auth0 Management API
*/
getUserByEmail(email: string): Promise<AuthUser | null>;
/**
* Health check
*/
healthCheck(): Promise<AuthHealthCheck>;
}