diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationServiceImpl.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationServiceImpl.java index 0679b5f1e2..859a0d8c55 100644 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationServiceImpl.java +++ b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationServiceImpl.java @@ -123,7 +123,7 @@ public class DynamicClientRegistrationServiceImpl implements DynamicClientRegist boolean isSaaSApp = profile.isSaasApp(); String audience = profile.getAudience(); String assertionConsumerURL = profile.getAssertionConsumerURL(); - String recepientValidationURL = profile.getRecepientValidationURL(); + String recipientValidationURL = profile.getRecepientValidationURL(); if (userId == null || userId.isEmpty()) { return null; @@ -223,7 +223,7 @@ public class DynamicClientRegistrationServiceImpl implements DynamicClientRegist samlssoServiceProviderDTO.setDoSignResponse(true); samlssoServiceProviderDTO.setRequestedAudiences(new String[] { audience }); samlssoServiceProviderDTO.setDefaultAssertionConsumerUrl(assertionConsumerURL); - samlssoServiceProviderDTO.setRequestedRecipients(new String[] {recepientValidationURL}); + samlssoServiceProviderDTO.setRequestedRecipients(new String[] {recipientValidationURL}); samlssoServiceProviderDTO.setDoSignAssertions(true); diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/DynamicClientWebAppRegistrationManager.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/DynamicClientWebAppRegistrationManager.java index fbb6023251..14e2ca00b6 100644 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/DynamicClientWebAppRegistrationManager.java +++ b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/DynamicClientWebAppRegistrationManager.java @@ -117,7 +117,7 @@ public class DynamicClientWebAppRegistrationManager { } public void initiateDynamicClientRegistration() { - String requiredDynamicClientRegistration, webAppName; + String requiredDynamicClientRegistration, webAppName, serviceProviderName; ServletContext servletContext; RegistrationProfile registrationProfile; OAuthAppDetails oAuthAppDetails; @@ -131,15 +131,15 @@ public class DynamicClientWebAppRegistrationManager { while (enumeration.hasMoreElements()) { oAuthAppDetails = new OAuthAppDetails(); webAppName = (String) enumeration.nextElement(); + serviceProviderName = DynamicClientWebAppRegistrationUtil.getUserName() + "_" + webAppName; servletContext = DynamicClientWebAppRegistrationManager.webAppContexts.get(webAppName); requiredDynamicClientRegistration = servletContext.getInitParameter( DynamicClientWebAppRegistrationConstants.DYNAMIC_CLIENT_REQUIRED_FLAG); //Java web-app section - if ((requiredDynamicClientRegistration != null) && (Boolean. - parseBoolean( - requiredDynamicClientRegistration))) { + if ((requiredDynamicClientRegistration != null) && (Boolean.parseBoolean( + requiredDynamicClientRegistration))) { //Check whether this is an already registered application - if (!dynamicClientWebAppRegistrationManager.isRegisteredOAuthApplication(webAppName)) { + if (!dynamicClientWebAppRegistrationManager.isRegisteredOAuthApplication(serviceProviderName)) { //Construct the RegistrationProfile registrationProfile = DynamicClientWebAppRegistrationUtil. constructRegistrationProfile(servletContext, webAppName); @@ -155,7 +155,7 @@ public class DynamicClientWebAppRegistrationManager { JaggeryOAuthConfigurationSettings jaggeryOAuthConfigurationSettings = DynamicClientWebAppRegistrationUtil.getJaggeryAppOAuthSettings(servletContext); if (jaggeryOAuthConfigurationSettings.isRequireDynamicClientRegistration()) { - if (!dynamicClientWebAppRegistrationManager.isRegisteredOAuthApplication(webAppName)) { + if (!dynamicClientWebAppRegistrationManager.isRegisteredOAuthApplication(serviceProviderName)) { registrationProfile = DynamicClientWebAppRegistrationUtil. constructRegistrationProfile(jaggeryOAuthConfigurationSettings, webAppName); diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientWebAppRegistrationUtil.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientWebAppRegistrationUtil.java index 9540d0e9e8..034e1e3f8c 100644 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientWebAppRegistrationUtil.java +++ b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientWebAppRegistrationUtil.java @@ -116,7 +116,7 @@ public class DynamicClientWebAppRegistrationUtil { resource.setContent(writer.toString()); resource.setMediaType(DynamicClientWebAppRegistrationConstants.ContentTypes.MEDIA_TYPE_XML); String resourcePath = DynamicClientWebAppRegistrationConstants.OAUTH_APP_DATA_REGISTRY_PATH + "/" + - oAuthAppDetails.getWebAppName(); + oAuthAppDetails.getClientName(); status = DynamicClientWebAppRegistrationUtil.putRegistryResource(resourcePath, resource); } catch (RegistryException e) { throw new DynamicClientRegistrationException( diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java index da7734a046..abe4eac0c4 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java @@ -102,7 +102,8 @@ public class OAuthAuthenticator implements WebappAuthenticator { resourceContextParam.setValue(requestUri + ":" + requestMethod); OAuth2TokenValidationRequestDTO.TokenValidationContextParam[] - tokenValidationContextParams = new OAuth2TokenValidationRequestDTO.TokenValidationContextParam[1]; + tokenValidationContextParams = + new OAuth2TokenValidationRequestDTO.TokenValidationContextParam[1]; tokenValidationContextParams[0] = resourceContextParam; dto.setContext(tokenValidationContextParams); @@ -110,14 +111,9 @@ public class OAuthAuthenticator implements WebappAuthenticator { AuthenticatorFrameworkDataHolder.getInstance().getoAuth2TokenValidationService().validate(dto); if (oAuth2TokenValidationResponseDTO.isValid()) { String username = oAuth2TokenValidationResponseDTO.getAuthorizedUser(); - // try { - authenticationInfo.setUsername(username); - authenticationInfo.setTenantDomain(MultitenantUtils.getTenantDomain(username)); - authenticationInfo.setTenantId(Utils.getTenantIdOFUser(username)); -// } catch (AuthenticationException e) { -// throw new AuthenticationException( -// "Error occurred while retrieving the tenant ID of user '" + username + "'", e); -// } + authenticationInfo.setUsername(username); + authenticationInfo.setTenantDomain(MultitenantUtils.getTenantDomain(username)); + authenticationInfo.setTenantId(Utils.getTenantIdOFUser(username)); if (oAuth2TokenValidationResponseDTO.isValid()) { authenticationInfo.setStatus(Status.CONTINUE); } @@ -148,7 +144,7 @@ public class OAuthAuthenticator implements WebappAuthenticator { tokenValue = tokenValue.substring(matcher.end()); } } - if(log.isDebugEnabled()) { + if (log.isDebugEnabled()) { log.debug("Oauth Token : " + tokenValue); } return tokenValue;