本文整理汇总了Java中org.wso2.carbon.identity.application.common.model.Claim.setClaimUri方法的典型用法代码示例。如果您正苦于以下问题:Java Claim.setClaimUri方法的具体用法?Java Claim.setClaimUri怎么用?Java Claim.setClaimUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.carbon.identity.application.common.model.Claim
的用法示例。
在下文中一共展示了Claim.setClaimUri方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addUserAttributesToCache
import org.wso2.carbon.identity.application.common.model.Claim; //导入方法依赖的package包/类
private void addUserAttributesToCache(SessionDataCacheEntry sessionDataCacheEntry, String code, String codeId) {
AuthorizationGrantCacheKey authorizationGrantCacheKey = new AuthorizationGrantCacheKey(code);
AuthorizationGrantCacheEntry authorizationGrantCacheEntry = new AuthorizationGrantCacheEntry(
sessionDataCacheEntry.getLoggedInUser().getUserAttributes());
String sub = sessionDataCacheEntry.getLoggedInUser().getUserAttributes().get("sub");
if(StringUtils.isBlank(sub)){
sub = sessionDataCacheEntry.getLoggedInUser().getAuthenticatedSubjectIdentifier();
}
if(StringUtils.isNotBlank(sub)){
ClaimMapping claimMapping = new ClaimMapping();
Claim claim = new Claim();
claim.setClaimUri("sub");
claimMapping.setRemoteClaim(claim);
sessionDataCacheEntry.getLoggedInUser().getUserAttributes().put(claimMapping, sub);
}
authorizationGrantCacheEntry.setNonceValue(sessionDataCacheEntry.getoAuth2Parameters().getNonce());
authorizationGrantCacheEntry.setCodeId(codeId);
AuthorizationGrantCache.getInstance().addToCacheByCode(authorizationGrantCacheKey, authorizationGrantCacheEntry);
}
示例2: getFederatedSubjectFromClaims
import org.wso2.carbon.identity.application.common.model.Claim; //导入方法依赖的package包/类
public static String getFederatedSubjectFromClaims(IdentityProvider identityProvider,
Map<ClaimMapping, String> claimMappings) {
String userIdClaimURI = identityProvider.getClaimConfig().getUserClaimURI();
ClaimMapping claimMapping = new ClaimMapping();
Claim claim = new Claim();
claim.setClaimUri(userIdClaimURI);
claimMapping.setRemoteClaim(claim);
claimMapping.setLocalClaim(claim);
return claimMappings.get(claimMapping);
}
示例3: getClaimMappingsMap
import org.wso2.carbon.identity.application.common.model.Claim; //导入方法依赖的package包/类
private Map<ClaimMapping, String> getClaimMappingsMap(Map<String, String> userAttributes) {
Map<ClaimMapping, String> results = new HashMap<ClaimMapping, String>();
for (Map.Entry<String, String> entry : userAttributes.entrySet()) {
ClaimMapping claimMapping = new ClaimMapping();
Claim claim = new Claim();
claim.setClaimUri(entry.getKey());
claimMapping.setRemoteClaim(claim);
results.put(claimMapping, entry.getValue());
}
return results;
}
示例4: getLocalIdPDefaultClaimValues
import org.wso2.carbon.identity.application.common.model.Claim; //导入方法依赖的package包/类
/**
* @param dbConnection
* @param idPName
* @param userClaimUri
* @param roleClaimUri
* @param idpId
* @param tenantId
* @return
* @throws SQLException
*/
private ClaimConfig getLocalIdPDefaultClaimValues(Connection dbConnection, String idPName,
String userClaimUri, String roleClaimUri,
int idpId, int tenantId) throws SQLException {
PreparedStatement prepStmt = null;
ResultSet rs = null;
String sqlStmt;
ClaimConfig claimConfig = new ClaimConfig();
try {
claimConfig.setLocalClaimDialect(true);
claimConfig.setRoleClaimURI(roleClaimUri);
claimConfig.setUserClaimURI(userClaimUri);
sqlStmt = IdPManagementConstants.SQLQueries.GET_LOCAL_IDP_DEFAULT_CLAIM_VALUES_SQL;
prepStmt = dbConnection.prepareStatement(sqlStmt);
prepStmt.setInt(1, idpId);
prepStmt.setInt(2, tenantId);
List<ClaimMapping> claimMappings = new ArrayList<ClaimMapping>();
rs = prepStmt.executeQuery();
while (rs.next()) {
ClaimMapping claimMapping = new ClaimMapping();
// empty claim.
Claim remoteClaim = new Claim();
Claim localClaim = new Claim();
localClaim.setClaimUri(rs.getString("CLAIM_URI"));
claimMapping.setLocalClaim(localClaim);
claimMapping.setRemoteClaim(remoteClaim);
claimMapping.setDefaultValue(rs.getString("DEFAULT_VALUE"));
if ((IdPManagementConstants.IS_TRUE_VALUE).equals(rs.getString("IS_REQUESTED"))) {
claimMapping.setRequested(true);
} else if (rs.getString("IS_REQUESTED").equals(IdPManagementConstants.IS_TRUE_VALUE)) {
claimMapping.setRequested(false);
}
claimMappings.add(claimMapping);
}
claimConfig.setClaimMappings(claimMappings.toArray(new ClaimMapping[claimMappings
.size()]));
return claimConfig;
} finally {
IdentityDatabaseUtil.closeAllConnections(null, rs, prepStmt);
}
}
示例5: getIdPClaimConfiguration
import org.wso2.carbon.identity.application.common.model.Claim; //导入方法依赖的package包/类
/**
* @param dbConnection
* @param idPName
* @param tenantId
* @return
* @throws IdentityProviderManagementException
* @throws SQLException
*/
private ClaimConfig getIdPClaimConfiguration(Connection dbConnection, String idPName,
String userClaimUri, String roleClaimUri, int idPId, int tenantId)
throws IdentityProviderManagementException, SQLException {
PreparedStatement prepStmt1 = null;
PreparedStatement prepStmt2 = null;
ResultSet rs1 = null;
ResultSet rs2 = null;
try {
List<Claim> claimList = new ArrayList<Claim>();
// SP_IDP_CLAIM_ID, SP_IDP_CLAIM
String sqlStmt = IdPManagementConstants.SQLQueries.GET_IDP_CLAIMS_SQL;
prepStmt1 = dbConnection.prepareStatement(sqlStmt);
prepStmt1.setInt(1, idPId);
rs1 = prepStmt1.executeQuery();
ClaimConfig claimConfig = new ClaimConfig();
while (rs1.next()) {
Claim identityProviderClaim = new Claim();
identityProviderClaim.setClaimId(rs1.getInt(1));
identityProviderClaim.setClaimUri(rs1.getString(2));
claimList.add(identityProviderClaim);
}
// populate claim configuration with identity provider claims.
claimConfig.setIdpClaims(claimList.toArray(new Claim[claimList.size()]));
claimConfig.setUserClaimURI(userClaimUri);
claimConfig.setRoleClaimURI(roleClaimUri);
List<ClaimMapping> claimMappings = new ArrayList<ClaimMapping>();
// SP_IDP_CLAIMS.SP_IDP_CLAIM SP_IDP_CLAIM_MAPPINGS.SP_LOCAL_CLAIM
sqlStmt = IdPManagementConstants.SQLQueries.GET_IDP_CLAIM_MAPPINGS_SQL;
prepStmt2 = dbConnection.prepareStatement(sqlStmt);
prepStmt2.setInt(1, idPId);
rs2 = prepStmt2.executeQuery();
while (rs2.next()) {
ClaimMapping claimMapping = new ClaimMapping();
Claim idpClaim = new Claim();
idpClaim.setClaimUri(rs2.getString("CLAIM"));
Claim localClaim = new Claim();
localClaim.setClaimUri(rs2.getString("LOCAL_CLAIM"));
claimMapping.setLocalClaim(localClaim);
claimMapping.setRemoteClaim(idpClaim);
claimMapping.setDefaultValue(rs2.getString("DEFAULT_VALUE"));
if ((IdPManagementConstants.IS_TRUE_VALUE).equals(rs2.getString("IS_REQUESTED"))) {
claimMapping.setRequested(true);
} else if ((IdPManagementConstants.IS_FALSE_VALUE).equals(rs2.getString("IS_REQUESTED"))) {
claimMapping.setRequested(false);
}
claimMappings.add(claimMapping);
}
claimConfig.setClaimMappings(claimMappings.toArray(new ClaimMapping[claimMappings
.size()]));
return claimConfig;
} finally {
IdentityDatabaseUtil.closeAllConnections(null, rs2, prepStmt2);
IdentityDatabaseUtil.closeAllConnections(null, rs1, prepStmt1);
}
}