-
Notifications
You must be signed in to change notification settings - Fork 239
Retrieve/ store claim value based on the claim wise configured store location #999
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
base: master
Are you sure you want to change the base?
Conversation
.../src/main/java/org/wso2/carbon/identity/governance/internal/IdentityMgtServiceComponent.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/wso2/carbon/identity/governance/listener/IdentityStoreEventListener.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/wso2/carbon/identity/governance/listener/IdentityStoreEventListener.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/wso2/carbon/identity/governance/listener/IdentityStoreEventListener.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/wso2/carbon/identity/governance/listener/IdentityStoreEventListener.java
Show resolved
Hide resolved
...e/src/main/java/org/wso2/carbon/identity/governance/listener/IdentityStoreEventListener.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/wso2/carbon/identity/governance/listener/IdentityStoreEventListener.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/wso2/carbon/identity/governance/listener/IdentityStoreEventListener.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/wso2/carbon/identity/governance/listener/IdentityStoreEventListener.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/wso2/carbon/identity/governance/listener/IdentityStoreEventListener.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/wso2/carbon/identity/governance/listener/IdentityStoreEventListener.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/wso2/carbon/identity/governance/listener/IdentityStoreEventListener.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/wso2/carbon/identity/governance/listener/IdentityStoreEventListener.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/wso2/carbon/identity/governance/listener/IdentityStoreEventListener.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/wso2/carbon/identity/governance/service/IdentityDataStoreServiceImpl.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/wso2/carbon/identity/governance/service/IdentityDataStoreServiceImpl.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/wso2/carbon/identity/governance/service/IdentityDataStoreServiceImpl.java
Outdated
Show resolved
Hide resolved
pom.xml
Outdated
|
|
||
| <!--Carbon Identity Framework Version--> | ||
| <carbon.identity.framework.version>7.8.300</carbon.identity.framework.version> | ||
| <carbon.identity.framework.version>7.8.327-SNAPSHOT</carbon.identity.framework.version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's bump the framework version once the dependent PR has merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay
.../src/main/java/org/wso2/carbon/identity/governance/internal/IdentityMgtServiceComponent.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/wso2/carbon/identity/governance/internal/IdentityMgtServiceComponent.java
Outdated
Show resolved
Hide resolved
| UserStoreManager storeManager) { | ||
| UserStoreManager storeManager) throws UserStoreException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's check why this detected as a change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the getLocalClaimInTenant method of IdentityMgtUtil.java (lines 90–102), a ClaimMetadataException is thrown but caught and handled as a UserStoreException.
...n.identity.governance/src/main/java/org/wso2/carbon/identity/governance/IdentityMgtUtil.java
Outdated
Show resolved
Hide resolved
...n.identity.governance/src/main/java/org/wso2/carbon/identity/governance/IdentityMgtUtil.java
Outdated
Show resolved
Hide resolved
...n.identity.governance/src/main/java/org/wso2/carbon/identity/governance/IdentityMgtUtil.java
Outdated
Show resolved
Hide resolved
...n.identity.governance/src/main/java/org/wso2/carbon/identity/governance/IdentityMgtUtil.java
Outdated
Show resolved
Hide resolved
...n.identity.governance/src/main/java/org/wso2/carbon/identity/governance/IdentityMgtUtil.java
Outdated
Show resolved
Hide resolved
...n.identity.governance/src/main/java/org/wso2/carbon/identity/governance/IdentityMgtUtil.java
Outdated
Show resolved
Hide resolved
...n.identity.governance/src/main/java/org/wso2/carbon/identity/governance/IdentityMgtUtil.java
Outdated
Show resolved
Hide resolved
...n.identity.governance/src/main/java/org/wso2/carbon/identity/governance/IdentityMgtUtil.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/wso2/carbon/identity/governance/listener/IdentityStoreEventListener.java
Outdated
Show resolved
Hide resolved
...n.identity.governance/src/main/java/org/wso2/carbon/identity/governance/IdentityMgtUtil.java
Outdated
Show resolved
Hide resolved
...n.identity.governance/src/main/java/org/wso2/carbon/identity/governance/IdentityMgtUtil.java
Outdated
Show resolved
Hide resolved
...n.identity.governance/src/main/java/org/wso2/carbon/identity/governance/IdentityMgtUtil.java
Outdated
Show resolved
Hide resolved
| String[] claimURIs = claims.keySet().toArray(new String[0]); | ||
|
|
||
| // Extract claims that have configured custom persistence from those that do not. | ||
| CustomPersistenceEnabledClaims customPersistenceEnabledClaims = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can pass the domain from here.
getCustomPersistenceEnabledClaims Let's think about a good method name. The method name should imply that it returns how claims are persisted.
Do we need both information to be returned?
Suggession:- filterIdentityDataStoreManagedClaims(String[] claimsURIs, String tenantDomain, String domain)
- Get the tenant domain from privilege carbon context.
Returning identity database managed claims should be enough as other claims will be user store managed claims. We don't need to return both explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in commit 8b77039. But the userStoreManager instance is passed as an argument due to code refactoring.
filterIdentityDataStoreManagedClaims(String[] claims, UserStoreManager userStoreManager )
...ity.governance/src/main/java/org/wso2/carbon/identity/governance/IdentityGovernanceUtil.java
Outdated
Show resolved
Hide resolved
| Map<String, String> userStorePersistentClaimMap = IdentityMgtUtil.extractRequiredClaimsFromClaimMap(claims, | ||
| customPersistenceEnabledClaims.getUserStorePersistentClaims()); | ||
| Map<String, String> identityStorePersistentClaimMap = IdentityMgtUtil.extractRequiredClaimsFromClaimMap(claims, | ||
| customPersistenceEnabledClaims.getIdentityStorePersistentClaims()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's see whether we can organize the logic in this manner.
We invoke a method which gives what are the identity db stored claims. It checkes attribute level data. server level, user store level data also.
In this class, we can simply rely on that information and store in the identity db.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean removing the hybrid and user store-based logic from this class, delegating it to a separate class (IdentityMgtUtils.java), and keeping this class responsible only for storing the given set of identity claims returned by that utility class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in commit 8b77039.
.../src/main/java/org/wso2/carbon/identity/governance/model/CustomPersistenceEnabledClaims.java
Outdated
Show resolved
Hide resolved
| Map.Entry<String, String> claim = claimsIterator.next(); | ||
| String key = claim.getKey(); | ||
| String value = claim.getValue(); | ||
| if (StringUtils.isEmpty(key)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have claims which don't have a key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In previously also, it was checked as a condition. Hence I didn't changed. I will check whether it is required.
|
TODO: Update unit tests. |
Proposed changes in this pull request
These changes facilitate the claim wise storage configuration. This allows to selectively configure the claim storage location.i.e. each claim can be chosen to store in either
IDENTITY_DBorUSER_STOREregardless of the claim being anidentity_claimor auser_claim.Related
The storage location of a claim is determined by the claim property
skipUserStore, which accepts a boolean value. By default, this property is set tonull. Only a selected subset of claims will have a specifically configured storage location using this property.For claims without a configured storage location
(skipUserStore = null), the system follows the default behavior:IDENTITY_DBUSER_STORE_DBIf there are any server-level configurations for claim storage, these defaults will apply to claims with
skipUserStore = null. However, for claims that have an explicitly configured storage location, the value ofskipUserStorewill override the server-level configuration.When should this PR be merged
[Please describe any preconditions that need to be addressed before we
can merge this pull request.]
Follow up actions
[List any possible follow-up actions here; for instance, testing data
migrations, software that we need to install on staging and production
environments.]
Checklist (for reviewing)
General
Functionality
Code
Tests
Security
Documentation