Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Allow to update console's callback urls & allowed origins" #556

Merged
merged 1 commit into from
Dec 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1036,18 +1036,7 @@ public void putInboundOAuthConfiguration(String applicationId, OpenIDConnectConf
* But for now we are handling the validation here.
*/
validateCORSOrigins(oidcConfigModel.getAllowedOrigins());
boolean isAllowUpdateSystemApps =
isAllowUpdateSystemAppOAuthConfigs(applicationId, oidcConfigModel);
try {
if (isAllowUpdateSystemApps) {
IdentityApplicationManagementUtil.setAllowUpdateSystemApplicationThreadLocal(true);
}
putInbound(applicationId, oidcConfigModel, OAuthInboundFunctions::putOAuthInbound);
} finally {
if (isAllowUpdateSystemApps) {
IdentityApplicationManagementUtil.removeAllowUpdateSystemApplicationThreadLocal();
}
}
putInbound(applicationId, oidcConfigModel, OAuthInboundFunctions::putOAuthInbound);
}

public void putInboundSAMLConfiguration(String applicationId, SAML2Configuration saml2Configuration) {
Expand Down Expand Up @@ -1150,37 +1139,6 @@ private boolean isAllowUpdateSystemApplication(String appName, ApplicationPatchM
return false;
}

/**
* Check whether the updating system application's Inbound OAuth Configs are allowed or not.
*
* @param appId Application id.
* @param newOidcConfigModel New oidc config model.
* @return true if allowed.
*/
private boolean isAllowUpdateSystemAppOAuthConfigs(String appId,
OpenIDConnectConfiguration newOidcConfigModel) {

ServiceProvider application = getServiceProvider(appId);
Set<String> systemApplications =
ApplicationManagementServiceHolder.getApplicationManagementService().getSystemApplications();
if (systemApplications == null ||
systemApplications.stream().noneMatch(application.getApplicationName()::equalsIgnoreCase)) {
return false;
}

// For the Console it is allowed to update callbackURLs and allowedOrigins.
if (StringUtils.equalsIgnoreCase(CONSOLE_APP, application.getApplicationName())) {
OpenIDConnectConfiguration oldOidcConfigModel =
getInbound(appId, OAUTH2, OAuthInboundFunctions::getOAuthConfiguration);
oldOidcConfigModel.setCallbackURLs(newOidcConfigModel.getCallbackURLs());
oldOidcConfigModel.setAllowedOrigins(newOidcConfigModel.getAllowedOrigins());
if (newOidcConfigModel.equals(oldOidcConfigModel)) {
return true;
}
}
return false;
}

/**
* Retrieve search condition from @{SearchContext}.
*
Expand Down
Loading