Class: OauthTokenMiddleware
api-oauth/oauth-token.middleware.OauthTokenMiddleware
Hierarchy
StateMiddleware
<{}, {client
:AuthClient
}>↳
OauthTokenMiddleware
Constructors
constructor
• new OauthTokenMiddleware(authClientService
, oauthTokenAuthorizationCodeMiddleware
, oauthTokenClientCredentialsMiddleware
)
Parameters
Name | Type |
---|---|
authClientService | AuthClientService |
oauthTokenAuthorizationCodeMiddleware | OAuthTokenAuthorizationCodeMiddleware |
oauthTokenClientCredentialsMiddleware | OAuthTokenClientCredentialsMiddleware |
Overrides
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
Name | Type |
---|---|
res | Response <any , Record <string , any >> |
appendedState | { error? : any } | Partial <{ client : AuthClient }> & { error? : any } |
Returns
void
Inherited from
Defined in
gropius-login-service/backend/src/api-oauth/StateMiddleware.ts:42
checkGivenClientSecretValidOrNotRequired
▸ Private
checkGivenClientSecretValidOrNotRequired(client
, givenSecret?
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
client | AuthClient |
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
Name | Type | Description |
---|---|---|
req | Request <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
Name | Type |
---|---|
req | Request <ParamsDictionary , any , any , ParsedQs , Record <string , any >> |
res | Response <any , Record <string , any >> |
next | (error? : any ) => any |
Returns
Promise
<void
>
Inherited from
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
Name | Type |
---|---|
req | Request <ParamsDictionary , any , any , ParsedQs , Record <string , any >> |
res | Response <any , Record <string , any >> |
state | Object |
state.error? | any |
error | any |
next | (error? : any ) => void |
Returns
void
Inherited from
Defined in
gropius-login-service/backend/src/api-oauth/StateMiddleware.ts:32
useWithState
▸ Protected
useWithState(req
, res
, state
, next
): Promise
<any
>
Parameters
Name | Type |
---|---|
req | Request <ParamsDictionary , any , any , ParsedQs , Record <string , any >> |
res | Response <any , Record <string , any >> |
state | Object |
state.error? | any |
next | (error? : any ) => void |
Returns
Promise
<any
>
Overrides
Defined in
gropius-login-service/backend/src/api-oauth/oauth-token.middleware.ts:81