Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
feat: refactor jwt props
Browse files Browse the repository at this point in the history
(cherry picked from commit ccda4b3)
  • Loading branch information
1nb0und committed Dec 25, 2023
1 parent 3a23cbe commit 149f7e3
Showing 1 changed file with 23 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,31 @@ public Authentication authentication() {

private JwtConfig configureJwtConfig() {
JwtConfig jwtConfig = new JwtConfig();
if (zeebeClientConfigurationProperties.isEnabled()) {
if (zeebeClientConfigurationProperties.getCloud().getClientId() != null && zeebeClientConfigurationProperties.getCloud().getClientSecret() != null) {
jwtConfig.addProduct(Product.ZEEBE, new JwtCredential(
zeebeClientConfigurationProperties.getCloud().getClientId(),
zeebeClientConfigurationProperties.getCloud().getClientSecret(),
zeebeClientConfigurationProperties.getCloud().getAudience(),
zeebeClientConfigurationProperties.getCloud().getAuthUrl())
);
} else if (commonConfigurationProperties.getClientId() != null && commonConfigurationProperties.getClientSecret() != null) {
jwtConfig.addProduct(Product.ZEEBE, new JwtCredential(
commonConfigurationProperties.getClientId(),
commonConfigurationProperties.getClientSecret(),
zeebeClientConfigurationProperties.getCloud().getAudience(),
zeebeClientConfigurationProperties.getCloud().getAuthUrl())
);
}
// ZEEBE
if (zeebeClientConfigurationProperties.getCloud().getClientId() != null && zeebeClientConfigurationProperties.getCloud().getClientSecret() != null) {
jwtConfig.addProduct(Product.ZEEBE, new JwtCredential(
zeebeClientConfigurationProperties.getCloud().getClientId(),
zeebeClientConfigurationProperties.getCloud().getClientSecret(),
zeebeClientConfigurationProperties.getCloud().getAudience(),
zeebeClientConfigurationProperties.getCloud().getAuthUrl())
);
} else if (zeebeSelfManagedProperties.getClientId() != null && zeebeSelfManagedProperties.getClientSecret() != null) {
jwtConfig.addProduct(Product.ZEEBE, new JwtCredential(
zeebeSelfManagedProperties.getClientId(),
zeebeSelfManagedProperties.getClientSecret(),
zeebeSelfManagedProperties.getAudience(),
zeebeSelfManagedProperties.getAuthServer())
);
} else if (commonConfigurationProperties.getClientId() != null && commonConfigurationProperties.getClientSecret() != null) {
jwtConfig.addProduct(Product.ZEEBE, new JwtCredential(
commonConfigurationProperties.getClientId(),
commonConfigurationProperties.getClientSecret(),
zeebeClientConfigurationProperties.getCloud().getAudience(),
zeebeClientConfigurationProperties.getCloud().getAuthUrl())
);
}

// OPERATE
String operateAuthUrl = zeebeClientConfigurationProperties.getCloud().getAuthUrl();
String operateAudience = "operate.camunda.io";
if (operateClientConfigurationProperties != null) {
Expand Down

0 comments on commit 149f7e3

Please sign in to comment.