keycloak-lambda-authorizer
Version:
123 lines • 3.96 kB
TypeScript
import { AdapterCache } from './cache/AdapterCache';
import { RestCalls } from './utils/restCalls';
import { EnforcerAction } from './enforcer/Enforcer';
import { UmaConfiguration } from './uma/UmaConfiguration';
import { ClientAuthorization } from './clients/ClientAuthorization';
import { JWKS } from './jwks/JWKS';
import { ServiceAccount } from './serviceaccount/ServiceAccount';
import { SecurityAdapter } from './adapters/SecurityAdapter';
import { ResourceChecker } from './enforcer/resource/Resource';
import { AwsAuthorizationEvent, AwsEvent } from './adapters/ApigatewayAdapter';
export declare type LoggerType = {
log: (...data: any[]) => void;
info: (...data: any[]) => void;
warn: (...data: any[]) => void;
error: (...data: any[]) => void;
debug: (...data: any[]) => void;
};
export declare type RSAKey = {
key: string;
passphrase?: string;
};
export declare type ClientJwtKeys = {
privateKey: RSAKey;
publicKey: RSAKey;
};
export declare type KeycloakJsonStructure = {
"realm": string;
"auth-server-url": string;
"ssl-required": string;
"resource": string;
"credentials"?: {
"secret": string;
};
};
export declare type JWTToken = {
payload: any;
tokenString: string;
header: {
alg: string;
kid: string;
};
};
export declare type TokenJson = {
access_token: any;
refresh_token: any;
decodedAccessToken: any;
decodedRefreshToken: any;
refresh_expires_in: number;
};
export declare type RequestContent = {
tokenString: string;
token: JWTToken;
request?: AwsEvent | AwsAuthorizationEvent | any;
realm?: string;
};
export declare type RequestContext = {
tokenString?: string;
token?: JWTToken;
request?: AwsEvent | AwsAuthorizationEvent | any;
realm?: string;
};
export declare type RefreshContext = {
token: TokenJson;
request?: any;
realm?: string;
};
export declare type keycloakJsonFunction = (options: AdapterContent, requestContent: RequestContent) => Promise<KeycloakJsonStructure> | KeycloakJsonStructure;
export declare type SecurityResource = {
name?: string;
uri?: string;
owner?: string;
type?: string;
scope?: string;
matchingUri?: boolean;
deep?: boolean;
first?: number;
max?: number;
};
export declare type ResourceHandlerFunc = (resourceJson: any, options: AdapterContent) => void;
export declare type ClientRole = {
clientId: string;
clientRole: string;
};
export declare type Enforcer = {
realmRole?: string;
clientRole?: ClientRole;
clientId?: string;
resource?: SecurityResource;
resources?: SecurityResource[];
};
export declare type EnforcerFunc = (options: AdapterContent, requestContent: RequestContent) => (Promise<Enforcer> | Enforcer);
export declare type EnforcerFunction = (EnforcerFunc | Enforcer);
export declare type AdapterContent = {
keys: ClientJwtKeys;
keycloakJson: keycloakJsonFunction;
logger: LoggerType;
cache: AdapterCache;
restClient: RestCalls;
enforcer: EnforcerAction;
umaConfiguration: UmaConfiguration;
clientAuthorization: ClientAuthorization;
serviceAccount: ServiceAccount;
securityAdapter: SecurityAdapter;
resourceChecker: ResourceChecker;
jwks: JWKS;
};
export declare type AdapterDependencies = {
keys?: ClientJwtKeys;
keycloakJson: keycloakJsonFunction | KeycloakJsonStructure;
cache?: AdapterCache;
logger?: LoggerType;
restClient?: RestCalls;
enforcer?: EnforcerAction;
umaConfiguration?: UmaConfiguration;
clientAuthorization?: ClientAuthorization;
serviceAccount?: ServiceAccount;
securityAdapter?: SecurityAdapter;
resourceChecker?: ResourceChecker;
jwks?: JWKS;
};
export declare function updateEnforce(enf: EnforcerFunction): EnforcerFunc;
export declare function updateOptions(opts: AdapterDependencies): AdapterContent;
//# sourceMappingURL=Options.d.ts.map