Java Code Examples for org.wso2.carbon.user.api.UserStoreManager#getUserClaimValue()
The following examples show how to use
org.wso2.carbon.user.api.UserStoreManager#getUserClaimValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultClaimHandler.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
private void setSubjectClaimForStandardDialect(String tenantAwareUserId, UserStoreManager userStore, AuthenticationContext context, String subjectURI) { try { String value = userStore.getUserClaimValue(tenantAwareUserId, subjectURI, null); if (value != null) { context.setProperty(SERVICE_PROVIDER_SUBJECT_CLAIM_VALUE, value); if (log.isDebugEnabled()) { log.debug("Setting \'ServiceProviderSubjectClaimValue\' property value " + "from user store " + value); } } else { if (log.isDebugEnabled()) { log.debug("Subject claim for " + tenantAwareUserId + " not found in user store"); } } } catch (UserStoreException e) { log.error("Error occurred while retrieving " + subjectURI + " claim value for user " + tenantAwareUserId, e); } }
Example 2
Source File: DefaultClaimHandler.java From carbon-identity with Apache License 2.0 | 6 votes |
private void setSubjectClaimForStandardDialect(String tenantAwareUserId, UserStoreManager userStore, AuthenticationContext context, String subjectURI) { try { String value = userStore.getUserClaimValue(tenantAwareUserId, subjectURI, null); if (value != null) { context.setProperty(SERVICE_PROVIDER_SUBJECT_CLAIM_VALUE, value); if (log.isDebugEnabled()) { log.debug("Setting \'ServiceProviderSubjectClaimValue\' property value " + "from user store " + value); } } else { if(log.isDebugEnabled()) { log.debug("Subject claim for " + tenantAwareUserId + " not found in user store"); } } } catch (UserStoreException e) { log.error("Error occurred while retrieving " + subjectURI + " claim value for user " + tenantAwareUserId, e); } }
Example 3
Source File: UserManagementServiceImpl.java From carbon-device-mgt with Apache License 2.0 | 4 votes |
private String getClaimValue(String username, String claimUri) throws UserStoreException { UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager(); return userStoreManager.getUserClaimValue(username, claimUri, null); }
Example 4
Source File: UserManagementServiceImpl.java From carbon-device-mgt with Apache License 2.0 | 4 votes |
private String getClaimValue(String username, String claimUri) throws UserStoreException { UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager(); return userStoreManager.getUserClaimValue(username, claimUri, null); }
Example 5
Source File: RecoveryProcessor.java From carbon-identity with Apache License 2.0 | 4 votes |
/** * Verifies user id with underline user store * * @param sequence TODO * @param userDTO bean class that contains user and tenant Information * @return true/false whether user is verified or not. If user is a tenant * user then always return false */ public VerificationBean verifyUserForRecovery(int sequence, UserDTO userDTO) { String userId = userDTO.getUserId(); int tenantId = userDTO.getTenantId(); boolean success = false; VerificationBean bean = null; try { UserStoreManager userStoreManager = IdentityMgtServiceComponent.getRealmService(). getTenantUserRealm(tenantId).getUserStoreManager(); if (userStoreManager.isExistingUser(userId)) { if (IdentityMgtConfig.getInstance().isAuthPolicyAccountLockCheck()) { String accountLock = userStoreManager. getUserClaimValue(userId, UserIdentityDataStore.ACCOUNT_LOCK, null); if (!Boolean.parseBoolean(accountLock)) { success = true; } } else { success = true; } } else { log.error("User with user name : " + userId + " does not exists in tenant domain : " + userDTO.getTenantDomain()); bean = new VerificationBean(VerificationBean.ERROR_CODE_INVALID_USER + " " + "User does not exists"); } if (success) { String internalCode = generateUserCode(sequence, userId); String key = UUID.randomUUID().toString(); UserRecoveryDataDO dataDO = new UserRecoveryDataDO(userId, tenantId, internalCode, key); if (sequence != 3) { dataStore.invalidate(userId, tenantId); } dataStore.store(dataDO); log.info("User verification successful for user : " + userId + " from tenant domain :" + userDTO.getTenantDomain()); bean = new VerificationBean(userId, getUserExternalCodeStr(internalCode)); } } catch (Exception e) { String errorMessage = "Error verifying user : " + userId; log.error(errorMessage, e); bean = new VerificationBean(VerificationBean.ERROR_CODE_UNEXPECTED + " " + errorMessage); } if (bean == null) { bean = new VerificationBean(VerificationBean.ERROR_CODE_UNEXPECTED); } return bean; }