From 93c9ab15bc6577fbfff6c56df4e601a6ada6fd10 Mon Sep 17 00:00:00 2001 From: Madhavi Gayathri Date: Thu, 27 Jun 2024 16:27:33 +0530 Subject: [PATCH] Add the pvt ket jwt config under ClientAuthenticationConfiguration. --- .../v1/ClientAuthenticationConfiguration.java | 41 +++++++++++++++++-- .../oauth2/ApiModelToOAuthConsumerApp.java | 1 + .../oauth2/OAuthConsumerAppToApiModel.java | 1 + .../src/main/resources/applications.yaml | 6 +++ 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ClientAuthenticationConfiguration.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ClientAuthenticationConfiguration.java index bb93182817..6c1ceae745 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ClientAuthenticationConfiguration.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ClientAuthenticationConfiguration.java @@ -28,6 +28,7 @@ public class ClientAuthenticationConfiguration { private String tokenEndpointAuthMethod; private String tokenEndpointAuthSigningAlg; + private Boolean tokenEndpointAllowReusePvtKeyJwt; private String tlsClientAuthSubjectDn; /** @@ -66,6 +67,30 @@ public void setTokenEndpointAuthSigningAlg(String tokenEndpointAuthSigningAlg) { this.tokenEndpointAuthSigningAlg = tokenEndpointAuthSigningAlg; } + /** + * Allow reuse of the private key for JWT generation at the token endpoint. + * + * @param tokenEndpointAllowReusePvtKeyJwt Allow reuse of the private key for JWT generation at the token endpoint. + * @return ClientAuthenticationConfiguration object. + **/ + public ClientAuthenticationConfiguration tokenEndpointAllowReusePvtKeyJwt( + Boolean tokenEndpointAllowReusePvtKeyJwt) { + + this.tokenEndpointAllowReusePvtKeyJwt = tokenEndpointAllowReusePvtKeyJwt; + return this; + } + + @ApiModelProperty(example = "false", value = "") + @JsonProperty("tokenEndpointAllowReusePvtKeyJwt") + @Valid + public Boolean isTokenEndpointAllowReusePvtKeyJwt() { + return tokenEndpointAllowReusePvtKeyJwt; + } + + public void setTokenEndpointAllowReusePvtKeyJwt(Boolean tokenEndpointAllowReusePvtKeyJwt) { + this.tokenEndpointAllowReusePvtKeyJwt = tokenEndpointAllowReusePvtKeyJwt; + } + /** **/ public ClientAuthenticationConfiguration tlsClientAuthSubjectDn(String tlsClientAuthSubjectDn) { @@ -94,14 +119,20 @@ public boolean equals(java.lang.Object o) { return false; } ClientAuthenticationConfiguration clientAuthenticationConfiguration = (ClientAuthenticationConfiguration) o; - return Objects.equals(this.tokenEndpointAuthMethod, clientAuthenticationConfiguration.tokenEndpointAuthMethod) && - Objects.equals(this.tokenEndpointAuthSigningAlg, clientAuthenticationConfiguration.tokenEndpointAuthSigningAlg) && - Objects.equals(this.tlsClientAuthSubjectDn, clientAuthenticationConfiguration.tlsClientAuthSubjectDn); + return Objects.equals(this.tokenEndpointAuthMethod, + clientAuthenticationConfiguration.tokenEndpointAuthMethod) && + Objects.equals(this.tokenEndpointAuthSigningAlg, + clientAuthenticationConfiguration.tokenEndpointAuthSigningAlg) && + Objects.equals(this.tlsClientAuthSubjectDn, clientAuthenticationConfiguration.tlsClientAuthSubjectDn) && + Objects.equals(this.tokenEndpointAllowReusePvtKeyJwt, + clientAuthenticationConfiguration.tokenEndpointAllowReusePvtKeyJwt); } @Override public int hashCode() { - return Objects.hash(tokenEndpointAuthMethod, tokenEndpointAuthSigningAlg, tlsClientAuthSubjectDn); + + return Objects.hash(tokenEndpointAuthMethod, tokenEndpointAuthSigningAlg, tokenEndpointAllowReusePvtKeyJwt, + tlsClientAuthSubjectDn); } @Override @@ -112,6 +143,8 @@ public String toString() { sb.append(" tokenEndpointAuthMethod: ").append(toIndentedString(tokenEndpointAuthMethod)).append("\n"); sb.append(" tokenEndpointAuthSigningAlg: ").append(toIndentedString(tokenEndpointAuthSigningAlg)).append("\n"); + sb.append(" tokenEndpointAllowReusePvtKeyJwt: ").append(toIndentedString(tokenEndpointAllowReusePvtKeyJwt)) + .append("\n"); sb.append(" tlsClientAuthSubjectDn: ").append(toIndentedString(tlsClientAuthSubjectDn)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/inbound/oauth2/ApiModelToOAuthConsumerApp.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/inbound/oauth2/ApiModelToOAuthConsumerApp.java index 6f29f808f0..1290c350ca 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/inbound/oauth2/ApiModelToOAuthConsumerApp.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/inbound/oauth2/ApiModelToOAuthConsumerApp.java @@ -200,6 +200,7 @@ private void updateClientAuthenticationConfigurations(OAuthConsumerAppDTO appDTO if (clientAuthentication != null) { appDTO.setTokenEndpointAuthMethod(clientAuthentication.getTokenEndpointAuthMethod()); appDTO.setTokenEndpointAuthSignatureAlgorithm(clientAuthentication.getTokenEndpointAuthSigningAlg()); + appDTO.setTokenEndpointAllowReusePvtKeyJwt(clientAuthentication.isTokenEndpointAllowReusePvtKeyJwt()); appDTO.setTlsClientAuthSubjectDN(clientAuthentication.getTlsClientAuthSubjectDn()); } } diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/inbound/oauth2/OAuthConsumerAppToApiModel.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/inbound/oauth2/OAuthConsumerAppToApiModel.java index d1ac1b6d60..d324a150f9 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/inbound/oauth2/OAuthConsumerAppToApiModel.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/functions/application/inbound/oauth2/OAuthConsumerAppToApiModel.java @@ -165,6 +165,7 @@ private ClientAuthenticationConfiguration buildClientAuthenticationConfiguration return new ClientAuthenticationConfiguration() .tokenEndpointAuthMethod(appDTO.getTokenEndpointAuthMethod()) .tokenEndpointAuthSigningAlg(appDTO.getTokenEndpointAuthSignatureAlgorithm()) + .tokenEndpointAllowReusePvtKeyJwt(appDTO.isTokenEndpointAllowReusePvtKeyJwt()) .tlsClientAuthSubjectDn(appDTO.getTlsClientAuthSubjectDN()); } diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/resources/applications.yaml b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/resources/applications.yaml index d9da96d6be..f3d2660d2e 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/resources/applications.yaml +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/resources/applications.yaml @@ -3689,6 +3689,9 @@ components: tokenEndpointAuthMethod: type: string example: 'client_secret_basic' + tokenEndpointAllowReusePvtKeyJwt: + type: boolean + example: false tokenEndpointAuthSigningAlg: type: string example: 'PS256' @@ -3955,6 +3958,9 @@ components: $ref: '#/components/schemas/MetadataProperty' tokenEndpointAuthMethod: $ref: '#/components/schemas/ClientAuthenticationMethodMetadata' + tokenEndpointAllowReusePvtKeyJwt: + type: boolean + default: false tokenEndpointSignatureAlgorithm: $ref: '#/components/schemas/MetadataProperty' idTokenSignatureAlgorithm: