Skip to main content

Abstract Class: BaseAuthOIDCRouteSQL

Defined in: src/routes/sql/BaseAuthOIDCRouteSQL.ts:8

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.

Extends

Constructors

Constructor

new BaseAuthOIDCRouteSQL(): BaseAuthOIDCRouteSQL

Returns

BaseAuthOIDCRouteSQL

Inherited from

BaseAuthOIDCRoute.constructor

Properties

aliasClass

protected aliasClass: any = AliasSQL

Defined in: src/routes/sql/BaseAuthOIDCRouteSQL.ts:9

Overrides

BaseAuthOIDCRoute.aliasClass


aliasRepo?

protected optional aliasRepo?: RepoUtils<AliasSQL>

Defined in: src/routes/BaseAuthOIDCRoute.ts:54

Inherited from

BaseAuthOIDCRoute.aliasRepo


authMiddleware?

protected optional authMiddleware?: AuthMiddleware

Defined in: src/routes/BaseAuthOIDCRoute.ts:57

Inherited from

BaseAuthOIDCRoute.authMiddleware


defaultScopes

protected defaultScopes: string[] = []

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

Inherited from

BaseAuthOIDCRoute.defaultScopes


jwtConfig?

protected optional jwtConfig?: any

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

Inherited from

BaseAuthOIDCRoute.jwtConfig


messagingUtils?

protected optional messagingUtils?: MessagingUtils

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

Inherited from

BaseAuthOIDCRoute.messagingUtils


profileClass

protected profileClass: any = ProfileSQL

Defined in: src/routes/sql/BaseAuthOIDCRouteSQL.ts:10

Overrides

BaseAuthOIDCRoute.profileClass


profileRepo?

protected optional profileRepo?: RepoUtils<ProfileSQL>

Defined in: src/routes/BaseAuthOIDCRoute.ts:68

Inherited from

BaseAuthOIDCRoute.profileRepo


providerConfig

abstract protected providerConfig: OIDCProvider

Defined in: src/routes/BaseAuthOIDCRoute.ts:70

Inherited from

BaseAuthOIDCRoute.providerConfig


strategyName

protected strategyName: string = "oauth"

Defined in: src/routes/BaseAuthOIDCRoute.ts:81

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.

Inherited from

BaseAuthOIDCRoute.strategyName


tokenUtils?

protected optional tokenUtils?: TokenUtils

Defined in: src/routes/BaseAuthOIDCRoute.ts:84

Inherited from

BaseAuthOIDCRoute.tokenUtils


userClass

protected userClass: any = UserSQL

Defined in: src/routes/sql/BaseAuthOIDCRouteSQL.ts:11

Overrides

BaseAuthOIDCRoute.userClass


userRepo?

protected optional userRepo?: RepoUtils<UserSQL>

Defined in: src/routes/BaseAuthOIDCRoute.ts:86

Inherited from

BaseAuthOIDCRoute.userRepo


userUtils?

protected optional userUtils?: UserUtils<UserSQL, AliasSQL>

Defined in: src/routes/BaseAuthOIDCRoute.ts:88

Inherited from

BaseAuthOIDCRoute.userUtils

Methods

login()

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

Defined in: src/routes/BaseAuthOIDCRoute.ts:311

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>

Inherited from

BaseAuthOIDCRoute.login