|
|
@ -160,13 +160,15 @@ public class DynamicClientRegistrationImpl implements DynamicClientRegistrationS
|
|
|
|
"Service");
|
|
|
|
"Service");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ServiceProvider existingServiceProvider = appMgtService.getApplication(applicationName);
|
|
|
|
ServiceProvider existingServiceProvider = appMgtService.getServiceProvider(
|
|
|
|
|
|
|
|
applicationName, tenantDomain);
|
|
|
|
|
|
|
|
|
|
|
|
if (existingServiceProvider == null) {
|
|
|
|
if (existingServiceProvider == null) {
|
|
|
|
appMgtService.createApplication(serviceProvider);
|
|
|
|
appMgtService.createApplication(serviceProvider, userName, tenantDomain);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ServiceProvider createdServiceProvider = appMgtService.getApplication(applicationName);
|
|
|
|
ServiceProvider createdServiceProvider = appMgtService.getServiceProvider(
|
|
|
|
|
|
|
|
applicationName, tenantDomain);
|
|
|
|
if (createdServiceProvider == null) {
|
|
|
|
if (createdServiceProvider == null) {
|
|
|
|
throw new DynamicClientRegistrationException(
|
|
|
|
throw new DynamicClientRegistrationException(
|
|
|
|
"Couldn't create Service Provider Application " + applicationName);
|
|
|
|
"Couldn't create Service Provider Application " + applicationName);
|
|
|
@ -254,7 +256,7 @@ public class DynamicClientRegistrationImpl implements DynamicClientRegistrationS
|
|
|
|
createdServiceProvider.setLocalAndOutBoundAuthenticationConfig(localOutboundAuthConfig);
|
|
|
|
createdServiceProvider.setLocalAndOutBoundAuthenticationConfig(localOutboundAuthConfig);
|
|
|
|
|
|
|
|
|
|
|
|
// Update the Service Provider app to add OAuthApp as an Inbound Authentication Config
|
|
|
|
// Update the Service Provider app to add OAuthApp as an Inbound Authentication Config
|
|
|
|
appMgtService.updateApplication(createdServiceProvider);
|
|
|
|
appMgtService.updateApplication(createdServiceProvider, tenantDomain, userName);
|
|
|
|
|
|
|
|
|
|
|
|
OAuthApplicationInfo oAuthApplicationInfo = new OAuthApplicationInfo();
|
|
|
|
OAuthApplicationInfo oAuthApplicationInfo = new OAuthApplicationInfo();
|
|
|
|
oAuthApplicationInfo.setClientId(createdApp.getOauthConsumerKey());
|
|
|
|
oAuthApplicationInfo.setClientId(createdApp.getOauthConsumerKey());
|
|
|
@ -329,12 +331,13 @@ public class DynamicClientRegistrationImpl implements DynamicClientRegistrationS
|
|
|
|
"Error occurred while retrieving Application Management" +
|
|
|
|
"Error occurred while retrieving Application Management" +
|
|
|
|
"Service");
|
|
|
|
"Service");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ServiceProvider createdServiceProvider = appMgtService.getApplication(applicationName);
|
|
|
|
ServiceProvider createdServiceProvider = appMgtService.getServiceProvider(
|
|
|
|
|
|
|
|
applicationName, tenantDomain);
|
|
|
|
if (createdServiceProvider == null) {
|
|
|
|
if (createdServiceProvider == null) {
|
|
|
|
throw new DynamicClientRegistrationException(
|
|
|
|
throw new DynamicClientRegistrationException(
|
|
|
|
"Couldn't retrieve Service Provider Application " + applicationName);
|
|
|
|
"Couldn't retrieve Service Provider Application " + applicationName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
appMgtService.deleteApplication(applicationName);
|
|
|
|
appMgtService.deleteApplication(applicationName, tenantDomain, userName);
|
|
|
|
status = true;
|
|
|
|
status = true;
|
|
|
|
} catch (IdentityApplicationManagementException e) {
|
|
|
|
} catch (IdentityApplicationManagementException e) {
|
|
|
|
throw new DynamicClientRegistrationException(
|
|
|
|
throw new DynamicClientRegistrationException(
|
|
|
@ -361,7 +364,8 @@ public class DynamicClientRegistrationImpl implements DynamicClientRegistrationS
|
|
|
|
"Service");
|
|
|
|
"Service");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (ApplicationManagementService.getInstance().getApplication(applicationName) != null) {
|
|
|
|
if (ApplicationManagementService.getInstance().getServiceProvider(applicationName,
|
|
|
|
|
|
|
|
CarbonContext.getThreadLocalCarbonContext().getTenantDomain()) != null) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (IdentityApplicationManagementException e) {
|
|
|
|
} catch (IdentityApplicationManagementException e) {
|
|
|
|