-
-
Notifications
You must be signed in to change notification settings - Fork 492
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(connector): support
client_secret_basic
and `client_secret_jwt…
…` methods for oauth2 connectors
- Loading branch information
Showing
24 changed files
with
726 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@logto/connector-oauth": minor | ||
"@logto/connector-oidc": minor | ||
--- | ||
|
||
Support `client_secret_basic` and `client_secret_jwt` token endpoint auth method for oauth & oidc connectors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
packages/connectors/connector-oauth2/src/oauth2/form-items.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { type ConnectorConfigFormItem, ConnectorConfigFormItemType } from '@logto/connector-kit'; | ||
|
||
import { TokenEndpointAuthMethod, ClientSecretJwtSigningAlgorithm } from './types.js'; | ||
|
||
export const authorizationEndpointFormItem: ConnectorConfigFormItem = Object.freeze({ | ||
key: 'authorizationEndpoint', | ||
label: 'Authorization Endpoint', | ||
type: ConnectorConfigFormItemType.Text, | ||
required: true, | ||
placeholder: '<authorization-endpoint>', | ||
}); | ||
|
||
export const tokenEndpointFormItem: ConnectorConfigFormItem = Object.freeze({ | ||
key: 'tokenEndpoint', | ||
label: 'Token Endpoint', | ||
type: ConnectorConfigFormItemType.Text, | ||
required: true, | ||
placeholder: '<token-endpoint>', | ||
}); | ||
|
||
export const clientIdFormItem: ConnectorConfigFormItem = Object.freeze({ | ||
key: 'clientId', | ||
label: 'Client ID', | ||
type: ConnectorConfigFormItemType.Text, | ||
required: true, | ||
placeholder: '<client-id>', | ||
}); | ||
|
||
export const clientSecretFormItem: ConnectorConfigFormItem = Object.freeze({ | ||
key: 'clientSecret', | ||
label: 'Client Secret', | ||
type: ConnectorConfigFormItemType.Text, | ||
required: true, | ||
placeholder: '<client-secret>', | ||
}); | ||
|
||
export const tokenEndpointAuthOptionsFormItems: ConnectorConfigFormItem[] = [ | ||
Object.freeze({ | ||
key: 'tokenEndpointAuthMethod', | ||
label: 'Token Endpoint Auth Method', | ||
type: ConnectorConfigFormItemType.Select, | ||
selectItems: [ | ||
{ | ||
title: TokenEndpointAuthMethod.ClientSecretPost, | ||
value: TokenEndpointAuthMethod.ClientSecretPost, | ||
}, | ||
{ | ||
title: TokenEndpointAuthMethod.ClientSecretBasic, | ||
value: TokenEndpointAuthMethod.ClientSecretBasic, | ||
}, | ||
{ | ||
title: TokenEndpointAuthMethod.ClientSecretJwt, | ||
value: TokenEndpointAuthMethod.ClientSecretJwt, | ||
}, | ||
], | ||
required: true, | ||
defaultValue: TokenEndpointAuthMethod.ClientSecretPost, | ||
description: 'The method used for client authentication at the token endpoint in OAuth 2.0.', | ||
}), | ||
Object.freeze({ | ||
key: 'clientSecretJwtSigningAlgorithm', | ||
label: 'Client Secret JWT Signing Algorithm', | ||
type: ConnectorConfigFormItemType.Select, | ||
selectItems: [ | ||
{ | ||
title: ClientSecretJwtSigningAlgorithm.HS256, | ||
value: ClientSecretJwtSigningAlgorithm.HS256, | ||
}, | ||
{ | ||
title: ClientSecretJwtSigningAlgorithm.HS384, | ||
value: ClientSecretJwtSigningAlgorithm.HS384, | ||
}, | ||
{ | ||
title: ClientSecretJwtSigningAlgorithm.HS512, | ||
value: ClientSecretJwtSigningAlgorithm.HS512, | ||
}, | ||
], | ||
showConditions: [ | ||
{ | ||
targetKey: 'tokenEndpointAuthMethod', | ||
expectValue: TokenEndpointAuthMethod.ClientSecretJwt, | ||
}, | ||
], | ||
required: true, | ||
defaultValue: ClientSecretJwtSigningAlgorithm.HS256, | ||
description: 'The signing algorithm used for the client secret JWT.', | ||
}), | ||
]; | ||
|
||
export const scopeFormItem: ConnectorConfigFormItem = Object.freeze({ | ||
key: 'scope', | ||
label: 'Scope', | ||
type: ConnectorConfigFormItemType.Text, | ||
required: false, | ||
placeholder: '<space-delimited-scope>', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './types.js'; | ||
export * from './utils.js'; | ||
export * from './form-items.js'; |
Oops, something went wrong.