Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for oAuth mTLS client authorization #161

Merged
merged 1 commit into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/oauth/lib/OAuthProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export class OAuthProvider implements IOAuthProvider {
private static readonly defaultTokenCache = `${homedir}/.camunda`
private cacheDir: string
private authServerUrl: string
private mTLSPrivateKey: string | undefined
private mTLSCertChain: string | undefined
private clientId: string | undefined
private clientSecret: string | undefined
private useFileCache: boolean
Expand Down Expand Up @@ -61,6 +63,12 @@ export class OAuthProvider implements IOAuthProvider {

this.clientId = config.ZEEBE_CLIENT_ID
this.clientSecret = config.ZEEBE_CLIENT_SECRET
this.mTLSPrivateKey = config.CAMUNDA_CUSTOM_PRIVATE_KEY_PATH
? fs.readFileSync(config.CAMUNDA_CUSTOM_PRIVATE_KEY_PATH).toString()
: undefined
this.mTLSCertChain = config.CAMUNDA_CUSTOM_CERT_CHAIN_PATH
? fs.readFileSync(config.CAMUNDA_CUSTOM_CERT_CHAIN_PATH).toString()
: undefined

this.consoleClientId = config.CAMUNDA_CONSOLE_CLIENT_ID
this.consoleClientSecret = config.CAMUNDA_CONSOLE_CLIENT_SECRET
Expand Down Expand Up @@ -284,6 +292,8 @@ export class OAuthProvider implements IOAuthProvider {
'user-agent': this.userAgentString,
accept: '*/*',
},
key: this.mTLSPrivateKey,
cert: this.mTLSCertChain,
}

trace(`Making token request to the token endpoint: `)
Expand Down
Loading