Fixed EMM-887

revert-70aa11f8
harshanl 9 years ago
parent fb3e7f4c33
commit 7c0996270f

@ -123,7 +123,7 @@ public class DynamicClientRegistrationServiceImpl implements DynamicClientRegist
boolean isSaaSApp = profile.isSaasApp(); boolean isSaaSApp = profile.isSaasApp();
String audience = profile.getAudience(); String audience = profile.getAudience();
String assertionConsumerURL = profile.getAssertionConsumerURL(); String assertionConsumerURL = profile.getAssertionConsumerURL();
String recepientValidationURL = profile.getRecepientValidationURL(); String recipientValidationURL = profile.getRecepientValidationURL();
if (userId == null || userId.isEmpty()) { if (userId == null || userId.isEmpty()) {
return null; return null;
@ -223,7 +223,7 @@ public class DynamicClientRegistrationServiceImpl implements DynamicClientRegist
samlssoServiceProviderDTO.setDoSignResponse(true); samlssoServiceProviderDTO.setDoSignResponse(true);
samlssoServiceProviderDTO.setRequestedAudiences(new String[] { audience }); samlssoServiceProviderDTO.setRequestedAudiences(new String[] { audience });
samlssoServiceProviderDTO.setDefaultAssertionConsumerUrl(assertionConsumerURL); samlssoServiceProviderDTO.setDefaultAssertionConsumerUrl(assertionConsumerURL);
samlssoServiceProviderDTO.setRequestedRecipients(new String[] {recepientValidationURL}); samlssoServiceProviderDTO.setRequestedRecipients(new String[] {recipientValidationURL});
samlssoServiceProviderDTO.setDoSignAssertions(true); samlssoServiceProviderDTO.setDoSignAssertions(true);

@ -117,7 +117,7 @@ public class DynamicClientWebAppRegistrationManager {
} }
public void initiateDynamicClientRegistration() { public void initiateDynamicClientRegistration() {
String requiredDynamicClientRegistration, webAppName; String requiredDynamicClientRegistration, webAppName, serviceProviderName;
ServletContext servletContext; ServletContext servletContext;
RegistrationProfile registrationProfile; RegistrationProfile registrationProfile;
OAuthAppDetails oAuthAppDetails; OAuthAppDetails oAuthAppDetails;
@ -131,15 +131,15 @@ public class DynamicClientWebAppRegistrationManager {
while (enumeration.hasMoreElements()) { while (enumeration.hasMoreElements()) {
oAuthAppDetails = new OAuthAppDetails(); oAuthAppDetails = new OAuthAppDetails();
webAppName = (String) enumeration.nextElement(); webAppName = (String) enumeration.nextElement();
serviceProviderName = DynamicClientWebAppRegistrationUtil.getUserName() + "_" + webAppName;
servletContext = DynamicClientWebAppRegistrationManager.webAppContexts.get(webAppName); servletContext = DynamicClientWebAppRegistrationManager.webAppContexts.get(webAppName);
requiredDynamicClientRegistration = servletContext.getInitParameter( requiredDynamicClientRegistration = servletContext.getInitParameter(
DynamicClientWebAppRegistrationConstants.DYNAMIC_CLIENT_REQUIRED_FLAG); DynamicClientWebAppRegistrationConstants.DYNAMIC_CLIENT_REQUIRED_FLAG);
//Java web-app section //Java web-app section
if ((requiredDynamicClientRegistration != null) && (Boolean. if ((requiredDynamicClientRegistration != null) && (Boolean.parseBoolean(
parseBoolean(
requiredDynamicClientRegistration))) { requiredDynamicClientRegistration))) {
//Check whether this is an already registered application //Check whether this is an already registered application
if (!dynamicClientWebAppRegistrationManager.isRegisteredOAuthApplication(webAppName)) { if (!dynamicClientWebAppRegistrationManager.isRegisteredOAuthApplication(serviceProviderName)) {
//Construct the RegistrationProfile //Construct the RegistrationProfile
registrationProfile = DynamicClientWebAppRegistrationUtil. registrationProfile = DynamicClientWebAppRegistrationUtil.
constructRegistrationProfile(servletContext, webAppName); constructRegistrationProfile(servletContext, webAppName);
@ -155,7 +155,7 @@ public class DynamicClientWebAppRegistrationManager {
JaggeryOAuthConfigurationSettings jaggeryOAuthConfigurationSettings = JaggeryOAuthConfigurationSettings jaggeryOAuthConfigurationSettings =
DynamicClientWebAppRegistrationUtil.getJaggeryAppOAuthSettings(servletContext); DynamicClientWebAppRegistrationUtil.getJaggeryAppOAuthSettings(servletContext);
if (jaggeryOAuthConfigurationSettings.isRequireDynamicClientRegistration()) { if (jaggeryOAuthConfigurationSettings.isRequireDynamicClientRegistration()) {
if (!dynamicClientWebAppRegistrationManager.isRegisteredOAuthApplication(webAppName)) { if (!dynamicClientWebAppRegistrationManager.isRegisteredOAuthApplication(serviceProviderName)) {
registrationProfile = DynamicClientWebAppRegistrationUtil. registrationProfile = DynamicClientWebAppRegistrationUtil.
constructRegistrationProfile(jaggeryOAuthConfigurationSettings, constructRegistrationProfile(jaggeryOAuthConfigurationSettings,
webAppName); webAppName);

@ -116,7 +116,7 @@ public class DynamicClientWebAppRegistrationUtil {
resource.setContent(writer.toString()); resource.setContent(writer.toString());
resource.setMediaType(DynamicClientWebAppRegistrationConstants.ContentTypes.MEDIA_TYPE_XML); resource.setMediaType(DynamicClientWebAppRegistrationConstants.ContentTypes.MEDIA_TYPE_XML);
String resourcePath = DynamicClientWebAppRegistrationConstants.OAUTH_APP_DATA_REGISTRY_PATH + "/" + String resourcePath = DynamicClientWebAppRegistrationConstants.OAUTH_APP_DATA_REGISTRY_PATH + "/" +
oAuthAppDetails.getWebAppName(); oAuthAppDetails.getClientName();
status = DynamicClientWebAppRegistrationUtil.putRegistryResource(resourcePath, resource); status = DynamicClientWebAppRegistrationUtil.putRegistryResource(resourcePath, resource);
} catch (RegistryException e) { } catch (RegistryException e) {
throw new DynamicClientRegistrationException( throw new DynamicClientRegistrationException(

@ -102,7 +102,8 @@ public class OAuthAuthenticator implements WebappAuthenticator {
resourceContextParam.setValue(requestUri + ":" + requestMethod); resourceContextParam.setValue(requestUri + ":" + requestMethod);
OAuth2TokenValidationRequestDTO.TokenValidationContextParam[] OAuth2TokenValidationRequestDTO.TokenValidationContextParam[]
tokenValidationContextParams = new OAuth2TokenValidationRequestDTO.TokenValidationContextParam[1]; tokenValidationContextParams =
new OAuth2TokenValidationRequestDTO.TokenValidationContextParam[1];
tokenValidationContextParams[0] = resourceContextParam; tokenValidationContextParams[0] = resourceContextParam;
dto.setContext(tokenValidationContextParams); dto.setContext(tokenValidationContextParams);
@ -110,14 +111,9 @@ public class OAuthAuthenticator implements WebappAuthenticator {
AuthenticatorFrameworkDataHolder.getInstance().getoAuth2TokenValidationService().validate(dto); AuthenticatorFrameworkDataHolder.getInstance().getoAuth2TokenValidationService().validate(dto);
if (oAuth2TokenValidationResponseDTO.isValid()) { if (oAuth2TokenValidationResponseDTO.isValid()) {
String username = oAuth2TokenValidationResponseDTO.getAuthorizedUser(); String username = oAuth2TokenValidationResponseDTO.getAuthorizedUser();
// try {
authenticationInfo.setUsername(username); authenticationInfo.setUsername(username);
authenticationInfo.setTenantDomain(MultitenantUtils.getTenantDomain(username)); authenticationInfo.setTenantDomain(MultitenantUtils.getTenantDomain(username));
authenticationInfo.setTenantId(Utils.getTenantIdOFUser(username)); authenticationInfo.setTenantId(Utils.getTenantIdOFUser(username));
// } catch (AuthenticationException e) {
// throw new AuthenticationException(
// "Error occurred while retrieving the tenant ID of user '" + username + "'", e);
// }
if (oAuth2TokenValidationResponseDTO.isValid()) { if (oAuth2TokenValidationResponseDTO.isValid()) {
authenticationInfo.setStatus(Status.CONTINUE); authenticationInfo.setStatus(Status.CONTINUE);
} }

Loading…
Cancel
Save