Skip to main content

Class: OauthTokenMiddleware

api-oauth/oauth-token.middleware.OauthTokenMiddleware

Hierarchy

Constructors

constructor

new OauthTokenMiddleware(authClientService, oauthTokenAuthorizationCodeMiddleware, oauthTokenClientCredentialsMiddleware)

Parameters

NameType
authClientServiceAuthClientService
oauthTokenAuthorizationCodeMiddlewareOAuthTokenAuthorizationCodeMiddleware
oauthTokenClientCredentialsMiddlewareOAuthTokenClientCredentialsMiddleware

Overrides

StateMiddleware.constructor

Defined in

gropius-login-service/backend/src/api-oauth/oauth-token.middleware.ts:15

Properties

authClientService

Private Readonly authClientService: AuthClientService

Defined in

gropius-login-service/backend/src/api-oauth/oauth-token.middleware.ts:16


logger

Private Readonly logger: Logger

Defined in

gropius-login-service/backend/src/api-oauth/oauth-token.middleware.ts:13


oauthTokenAuthorizationCodeMiddleware

Private Readonly oauthTokenAuthorizationCodeMiddleware: OAuthTokenAuthorizationCodeMiddleware

Defined in

gropius-login-service/backend/src/api-oauth/oauth-token.middleware.ts:17


oauthTokenClientCredentialsMiddleware

Private Readonly oauthTokenClientCredentialsMiddleware: OAuthTokenClientCredentialsMiddleware

Defined in

gropius-login-service/backend/src/api-oauth/oauth-token.middleware.ts:18

Methods

appendState

Protected appendState(res, appendedState): void

Parameters

NameType
resResponse<any, Record<string, any>>
appendedState{ error?: any } | Partial<{ client: AuthClient }> & { error?: any }

Returns

void

Inherited from

StateMiddleware.appendState

Defined in

gropius-login-service/backend/src/api-oauth/StateMiddleware.ts:42


checkGivenClientSecretValidOrNotRequired

Private checkGivenClientSecretValidOrNotRequired(client, givenSecret?): Promise<boolean>

Parameters

NameType
clientAuthClient
givenSecret?string

Returns

Promise<boolean>

Defined in

gropius-login-service/backend/src/api-oauth/oauth-token.middleware.ts:23


getCallingClient

Private getCallingClient(req): Promise<AuthClient>

Performs the OAuth client authentication by checking the given client_id and client_secret in the Authorization header and in the body (both allowed according to OAuth spec).

Flag can be set to return any client without secrets if desired to allow logins without client

Parameters

NameTypeDescription
reqRequest<ParamsDictionary, any, any, ParsedQs, Record<string, any>>The request object

Returns

Promise<AuthClient>

The auth client that requested (or any without secret if flag ist set) or null if credentials invalid or none given

Defined in

gropius-login-service/backend/src/api-oauth/oauth-token.middleware.ts:49


use

use(req, res, next): Promise<void>

Parameters

NameType
reqRequest<ParamsDictionary, any, any, ParsedQs, Record<string, any>>
resResponse<any, Record<string, any>>
next(error?: any) => any

Returns

Promise<void>

Inherited from

StateMiddleware.use

Defined in

gropius-login-service/backend/src/api-oauth/StateMiddleware.ts:8


useWithError

Protected useWithError(req, res, state, error, next): void

Overwrite this to handle errors

Parameters

NameType
reqRequest<ParamsDictionary, any, any, ParsedQs, Record<string, any>>
resResponse<any, Record<string, any>>
stateObject
state.error?any
errorany
next(error?: any) => void

Returns

void

Inherited from

StateMiddleware.useWithError

Defined in

gropius-login-service/backend/src/api-oauth/StateMiddleware.ts:32


useWithState

Protected useWithState(req, res, state, next): Promise<any>

Parameters

NameType
reqRequest<ParamsDictionary, any, any, ParsedQs, Record<string, any>>
resResponse<any, Record<string, any>>
stateObject
state.error?any
next(error?: any) => void

Returns

Promise<any>

Overrides

StateMiddleware.useWithState

Defined in

gropius-login-service/backend/src/api-oauth/oauth-token.middleware.ts:81