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 OIDC clientName property #41630

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ public class OidcCommonConfig {
@ConfigItem
public Optional<String> clientId = Optional.empty();

/**
* The client name of the application. It is meant to represent a human readable description of the application which you
* may provide when an application (client) is registered in an OpenId Connect provider's dashboard.
* For example, you can set this property to have more informative log messages which record an activity of the given
* client.
*/
@ConfigItem
public Optional<String> clientName = Optional.empty();

/**
* The duration to attempt the initial connection to an OIDC server.
* For example, setting the duration to `20S` allows 10 retries, each 2 seconds apart.
Expand Down Expand Up @@ -736,6 +745,14 @@ public void setClientId(String clientId) {
this.clientId = Optional.of(clientId);
}

public Optional<String> getClientName() {
return clientName;
}

public void setClientName(String clientName) {
this.clientName = Optional.of(clientName);
}

public Credentials getCredentials() {
return credentials;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,10 @@ public Uni<ChallengeData> apply(TenantConfigContext tenantContext) {
}

public Uni<ChallengeData> getChallengeInternal(RoutingContext context, TenantConfigContext configContext) {
LOG.debugf("Starting an authentication challenge for tenant %s", configContext.oidcConfig.tenantId.get());
LOG.debugf("Starting an authentication challenge for tenant %s.", configContext.oidcConfig.tenantId.get());
if (configContext.oidcConfig.clientName.isPresent()) {
LOG.debugf(" Client name: %s", configContext.oidcConfig.clientName.get());
}

OidcTenantConfig sessionCookieConfig = configContext.oidcConfig;
String sessionTenantIdSetByCookie = context.get(OidcUtils.TENANT_ID_SET_BY_SESSION_COOKIE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,10 @@ private TokenVerificationResult verifyJwtTokenInternal(String token,
detail = details.get(0).getErrorMessage();
}
if (oidcConfig.clientId.isPresent()) {
LOG.debugf("Verification of the token issued to client %s has failed: %s", oidcConfig.clientId.get(), detail);
LOG.debugf("Verification of the token issued to client %s has failed: %s.", oidcConfig.clientId.get(), detail);
if (oidcConfig.clientName.isPresent()) {
LOG.debugf(" Client name: %s", oidcConfig.clientName.get());
}
} else {
LOG.debugf("Token verification has failed: %s", detail);
}
Expand Down