mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Fixed EMM-887
This commit is contained in:
parent
fb3e7f4c33
commit
7c0996270f
@ -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);
|
||||
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user