-
Notifications
You must be signed in to change notification settings - Fork 618
Add preferences API resource with POST method #8150
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
Merged
ZiyamSanthosh
merged 1 commit into
wso2:master
from
raviendalpatadu:configs/preferences_endpoint
Jul 15, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
.../src/main/java/org/wso2/carbon/identity/configuration/mgt/core/DefaultConfigResolver.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * Copyright (c) 2026, WSO2 LLC. (http://www.wso2.com). | ||
| * | ||
| * WSO2 LLC. licenses this file to you under the Apache License, | ||
| * Version 2.0 (the "License"); you may not use this file except | ||
| * in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.wso2.carbon.identity.configuration.mgt.core; | ||
|
|
||
| import org.wso2.carbon.identity.configuration.mgt.core.model.Resource; | ||
| import org.wso2.carbon.identity.configuration.mgt.core.model.ResourceIdentifier; | ||
|
|
||
| /** | ||
| * Interface for resolving default configurations for a given resource type and name. | ||
| */ | ||
| public interface DefaultConfigResolver { | ||
|
|
||
| /** | ||
| * Get the resource identifier that this resolver can handle. | ||
| * @return ResourceIdentifier of the default configuration. | ||
| */ | ||
| ResourceIdentifier getResourceIdentifier(); | ||
|
|
||
| /** | ||
| * Get the default configurations for the given resource type and name. | ||
| * | ||
| * @param resourceTypeName Name of the resource type. | ||
| * @param resourceName Name of the resource. | ||
| * @return Resource containing the default configurations. | ||
| */ | ||
| Resource getDefaultConfigs(String resourceTypeName, String resourceName); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,5 @@ | ||||||||||||||||||||||
| /* | ||||||||||||||||||||||
| * Copyright (c) 2019-2025, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. | ||||||||||||||||||||||
| * Copyright (c) 2019-2026, WSO2 LLC. (http://www.wso2.com) All Rights Reserved. | ||||||||||||||||||||||
| * | ||||||||||||||||||||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||
| * you may not use this file except in compliance with the License. | ||||||||||||||||||||||
|
|
@@ -16,22 +16,32 @@ | |||||||||||||||||||||
|
|
||||||||||||||||||||||
|
raviendalpatadu marked this conversation as resolved.
|
||||||||||||||||||||||
| package org.wso2.carbon.identity.configuration.mgt.core.internal; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| import org.apache.commons.logging.Log; | ||||||||||||||||||||||
| import org.apache.commons.logging.LogFactory; | ||||||||||||||||||||||
| import org.wso2.carbon.identity.configuration.mgt.core.DefaultConfigResolver; | ||||||||||||||||||||||
| import org.wso2.carbon.identity.configuration.mgt.core.model.ResourceIdentifier; | ||||||||||||||||||||||
| import org.wso2.carbon.identity.organization.management.service.OrganizationManager; | ||||||||||||||||||||||
| import org.wso2.carbon.identity.organization.resource.hierarchy.traverse.service.OrgResourceResolverService; | ||||||||||||||||||||||
| import org.wso2.carbon.user.core.service.RealmService; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| import java.util.HashMap; | ||||||||||||||||||||||
| import java.util.Map; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * A class to keep the data of the configuration manager component. | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| public class ConfigurationManagerComponentDataHolder { | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| private static final Log LOG = LogFactory.getLog(ConfigurationManagerComponentDataHolder.class); | ||||||||||||||||||||||
| private static ConfigurationManagerComponentDataHolder instance = new ConfigurationManagerComponentDataHolder(); | ||||||||||||||||||||||
| private static boolean useCreatedTime = false; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| private boolean configurationManagementEnabled; | ||||||||||||||||||||||
| private RealmService realmService; | ||||||||||||||||||||||
| private OrganizationManager organizationManager; | ||||||||||||||||||||||
| private OrgResourceResolverService orgResourceResolverService; | ||||||||||||||||||||||
| private final Map<ResourceIdentifier, DefaultConfigResolver> defaultConfigResolvers = new HashMap<>(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| public static ConfigurationManagerComponentDataHolder getInstance() { | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -107,4 +117,51 @@ public void setOrgResourceResolverService(OrgResourceResolverService orgResource | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| this.orgResourceResolverService = orgResourceResolverService; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Add a DefaultConfigResolver. | ||||||||||||||||||||||
| * | ||||||||||||||||||||||
| * @param resolver DefaultConfigResolver to add. | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| public void addDefaultConfigResolver(DefaultConfigResolver resolver) { | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ResourceIdentifier resourceIdentifier = resolver.getResourceIdentifier(); | ||||||||||||||||||||||
| if (resourceIdentifier == null) { | ||||||||||||||||||||||
| if(LOG.isDebugEnabled()){ | ||||||||||||||||||||||
| LOG.debug("Skipping registration of DefaultConfigResolver with a null resource identifier: " | ||||||||||||||||||||||
| + resolver.getClass().getName()); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| return; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| defaultConfigResolvers.put(resourceIdentifier, resolver); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
Comment on lines
+125
to
+137
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Log Improvement Suggestion No: 5
Suggested change
coderabbitai[bot] marked this conversation as resolved.
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Remove a DefaultConfigResolver. | ||||||||||||||||||||||
| * | ||||||||||||||||||||||
| * @param resolver DefaultConfigResolver to remove. | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| public void removeDefaultConfigResolver(DefaultConfigResolver resolver) { | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ResourceIdentifier resourceIdentifier = resolver.getResourceIdentifier(); | ||||||||||||||||||||||
| if (resourceIdentifier == null) { | ||||||||||||||||||||||
| if(LOG.isDebugEnabled()) { | ||||||||||||||||||||||
| LOG.debug("Skipping removal of DefaultConfigResolver with a null resource identifier: " | ||||||||||||||||||||||
| + resolver.getClass().getName()); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| return; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| defaultConfigResolvers.remove(resourceIdentifier); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Get the DefaultConfigResolver for the given resource type and name. | ||||||||||||||||||||||
| * @param resourceType | ||||||||||||||||||||||
| * @param resourceName | ||||||||||||||||||||||
| * @return | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| public DefaultConfigResolver getDefaultConfigResolver(String resourceType, String resourceName){ | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| return defaultConfigResolvers.get(new ResourceIdentifier(resourceType, resourceName)); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
Comment on lines
+144
to
167
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Log Improvement Suggestion No: 6
Suggested change
|
||||||||||||||||||||||
62 changes: 62 additions & 0 deletions
62
...c/main/java/org/wso2/carbon/identity/configuration/mgt/core/model/ResourceIdentifier.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| /* | ||
| * Copyright (c) 2026, WSO2 LLC. (http://www.wso2.com). | ||
| * | ||
| * WSO2 LLC. licenses this file to you under the Apache License, | ||
| * Version 2.0 (the "License"); you may not use this file except | ||
| * in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.wso2.carbon.identity.configuration.mgt.core.model; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * A model class to Identify a Configuration Resource uniquely by its type and name. | ||
| */ | ||
| public class ResourceIdentifier { | ||
|
|
||
| private String resourceType; | ||
| private String resourceName; | ||
|
|
||
| public ResourceIdentifier(String resourceType, String resourceName) { | ||
|
|
||
| this.resourceType = resourceType; | ||
| this.resourceName = resourceName; | ||
| } | ||
|
|
||
| public String getResourceType() { | ||
|
|
||
| return resourceType; | ||
| } | ||
|
|
||
| public String getResourceName() { | ||
|
|
||
| return resourceName; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
|
|
||
| if (!(o instanceof ResourceIdentifier that)) { | ||
| return false; | ||
| } | ||
| return Objects.equals(resourceType, that.resourceType) && | ||
|
raviendalpatadu marked this conversation as resolved.
|
||
| Objects.equals(resourceName, that.resourceName); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
|
raviendalpatadu marked this conversation as resolved.
|
||
|
|
||
| return Objects.hash(resourceType, resourceName); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.