Skip to main content

Abstract Class: BaseAuthOIDCRouteMongo

Defined in: auth/src/routes/mongo/BaseAuthOIDCRouteMongo.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 BaseAuthOIDCRouteMongo(): BaseAuthOIDCRouteMongo

Returns​

BaseAuthOIDCRouteMongo

Inherited from​

BaseAuthOIDCRoute.constructor

Properties​

aliasClass​

protected aliasClass: any = AliasMongo

Defined in: auth/src/routes/mongo/BaseAuthOIDCRouteMongo.ts:9

Overrides​

BaseAuthOIDCRoute.aliasClass


aliasRepo?​

protected optional aliasRepo?: RepoUtils<AliasMongo>

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

Inherited from​

BaseAuthOIDCRoute.aliasRepo


authMiddleware?​

protected optional authMiddleware?: AuthMiddleware

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

Inherited from​

BaseAuthOIDCRoute.authMiddleware


defaultScopes​

protected defaultScopes: string[] = []

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

Inherited from​

BaseAuthOIDCRoute.defaultScopes


jwtConfig?​

protected optional jwtConfig?: any

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

Inherited from​

BaseAuthOIDCRoute.jwtConfig


messagingUtils?​

protected optional messagingUtils?: MessagingUtils

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

Inherited from​

BaseAuthOIDCRoute.messagingUtils


profileClass​

protected profileClass: any = ProfileMongo

Defined in: auth/src/routes/mongo/BaseAuthOIDCRouteMongo.ts:11

Overrides​

BaseAuthOIDCRoute.profileClass


profileRepo?​

protected optional profileRepo?: RepoUtils<ProfileMongo>

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

Inherited from​

BaseAuthOIDCRoute.profileRepo


providerConfig​

abstract protected providerConfig: OIDCProvider

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

Inherited from​

BaseAuthOIDCRoute.providerConfig


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.

Inherited from​

BaseAuthOIDCRoute.strategyName


systemSettingsClass​

protected systemSettingsClass: any = SystemSettingsMongo

Defined in: auth/src/routes/mongo/BaseAuthOIDCRouteMongo.ts:10

Overrides​

BaseAuthOIDCRoute.systemSettingsClass


systemSettingsUtils?​

protected optional systemSettingsUtils?: SystemSettingsUtils

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

Inherited from​

BaseAuthOIDCRoute.systemSettingsUtils


tokenUtils?​

protected optional tokenUtils?: TokenUtils

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

Inherited from​

BaseAuthOIDCRoute.tokenUtils


userClass​

protected userClass: any = UserMongo

Defined in: auth/src/routes/mongo/BaseAuthOIDCRouteMongo.ts:12

Overrides​

BaseAuthOIDCRoute.userClass


userRepo?​

protected optional userRepo?: RepoUtils<UserMongo>

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

Inherited from​

BaseAuthOIDCRoute.userRepo


userUtils?​

protected optional userUtils?: UserUtils<UserMongo, AliasMongo>

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

Inherited from​

BaseAuthOIDCRoute.userUtils

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>

Inherited from​

BaseAuthOIDCRoute.isRegistrationAllowed


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>

Inherited from​

BaseAuthOIDCRoute.login