Skip to main content

Abstract Class: BaseAuthOIDCRoute<U, A, P>

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:49

IMPORTANT!! A subclass using a non-default strategyName (see its own doc comment — required for a multi-provider setup) MUST override this method with a matching @Auth([...]), delegating to super.login(...) for the actual token issuance, e.g.:

protected strategyName = "google";

@Auth(["google"])
public override async login(@User user: JWTUser, @Request req: HttpRequest, @Response res: HttpResponse) {
return super.login(user, req, res);
}

@Auth([...])'s strategy list is read from decorator metadata attached to the declaring class at load time, not re-evaluated per instance — a subclass that doesn't redeclare login() inherits this base implementation's @Auth(["oauth"]) regardless of its own strategyName.

Extended by​

Type Parameters​

U​

U extends User

A​

A extends Alias

P​

P extends Profile

Constructors​

Constructor​

new BaseAuthOIDCRoute<U, A, P>(): BaseAuthOIDCRoute<U, A, P>

Returns​

BaseAuthOIDCRoute<U, A, P>

Properties​

aliasClass​

abstract protected aliasClass: any

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:50


aliasRepo?​

protected optional aliasRepo?: RepoUtils<A>

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:58


authMiddleware?​

protected optional authMiddleware?: AuthMiddleware

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:63


defaultScopes​

protected defaultScopes: string[] = []

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:66


jwtConfig?​

protected optional jwtConfig?: any

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:69


messagingUtils?​

protected optional messagingUtils?: MessagingUtils

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:72


profileClass​

abstract protected profileClass: any

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:51


profileRepo?​

protected optional profileRepo?: RepoUtils<P>

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:74


providerConfig​

abstract protected providerConfig: OIDCProvider

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:76


strategyName​

protected strategyName: string = "oauth"

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:87

The name this route's strategy registers under in AuthMiddleware, and the name login()'s @Auth([...]) must match. Defaults to "oauth" for backward compatibility with a single-provider setup. An app wiring up more than one BaseAuthOIDCRoute subclass (e.g. one per third-party provider) MUST give each a distinct strategyName and override login() with a matching @Auth([...]) — otherwise every subclass registers under the same shared name and the last one loaded silently wins for all of them. See login()'s own doc comment for the override pattern.


systemSettingsClass?​

abstract protected optional systemSettingsClass?: any

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:52


systemSettingsUtils?​

protected optional systemSettingsUtils?: SystemSettingsUtils

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:60


tokenUtils?​

protected optional tokenUtils?: TokenUtils

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:90


userClass​

abstract protected userClass: any

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:53


userRepo?​

protected optional userRepo?: RepoUtils<U>

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:92


userUtils?​

protected optional userUtils?: UserUtils<U, A>

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:94

Methods​

isRegistrationAllowed()​

protected isRegistrationAllowed(): Promise<boolean>

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:323

Returns true if new accounts may currently be registered. Reads the runtime SystemSettings when systemSettingsClass is set, otherwise (or for anything not stored) falls back to @Config("auth:allowRegistration").

Returns​

Promise<boolean>


login()​

login(user, req, res): Promise<AuthResult | undefined>

Defined in: auth/src/routes/BaseAuthOIDCRoute.ts:342

Authenticates the user using OIDC and returns a JSON Web Token access token to be used with future API requests. A request with no code redirects the browser to the provider's authorization page by default; pass ?no_redirect=true to receive { url } as JSON instead (see OIDCStrategy.authenticate()) — lets a JS-driven frontend fetch the URL itself and treat a failure to build it as a normal API error it can render, rather than the browser landing on a raw response after an automatic redirect.

Parameters​

user​

JWTUser

req​

HttpRequest

res​

HttpResponse

Returns​

Promise<AuthResult | undefined>