当前位置: 首页>>代码示例>>Java>>正文


Java ClaimMapping类代码示例

本文整理汇总了Java中org.wso2.carbon.user.core.claim.ClaimMapping的典型用法代码示例。如果您正苦于以下问题:Java ClaimMapping类的具体用法?Java ClaimMapping怎么用?Java ClaimMapping使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ClaimMapping类属于org.wso2.carbon.user.core.claim包,在下文中一共展示了ClaimMapping类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.wso2.carbon.user.core.claim.ClaimMapping; //导入依赖的package包/类
@Override
public void init(RealmConfiguration realmConfiguration, Map<String, ClaimMapping> map,
        Map<String, ProfileConfiguration> map1, int tenantId) throws UserStoreException {
    this.realmConfiguration = realmConfiguration;
    this.tenantId = tenantId;
    ((MockUserStoreManager)this.userStoreManager).setRealmConfiguration(this.realmConfiguration);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:8,代码来源:MockRealm.java

示例2: init

import org.wso2.carbon.user.core.claim.ClaimMapping; //导入依赖的package包/类
/**
 * Initialize WSRealm by Carbon
 *
 * @see org.wso2.carbon.user.core.UserRealm#init(org.wso2.carbon.user.api.RealmConfiguration, java.util.Map, int)
 */
@Override
public void init(RealmConfiguration configBean, Map<String, ClaimMapping> claimMapping,
                 Map<String, ProfileConfiguration> profileConfigs, int tenantId)
        throws UserStoreException {
    ConfigurationContext configCtxt =
            UserMgtWSAPIDSComponent.
                    getCcServiceInstance().
                    getClientConfigContext();
    init(configBean, configCtxt);
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:16,代码来源:WSRealm.java

示例3: convertLocalClaimToClaimMapping

import org.wso2.carbon.user.core.claim.ClaimMapping; //导入依赖的package包/类
public static ClaimMapping convertLocalClaimToClaimMapping(LocalClaim localClaim, int tenantId) throws
        UserStoreException {

    ClaimMapping claimMapping = new ClaimMapping();

    Claim claim = new Claim();
    claim.setClaimUri(localClaim.getClaimURI());
    claim.setDialectURI(localClaim.getClaimDialectURI());

    Map<String, String> claimProperties = localClaim.getClaimProperties();

    if (claimProperties.containsKey(ClaimConstants.DISPLAY_NAME_PROPERTY)) {
        claim.setDisplayTag(claimProperties.get(ClaimConstants.DISPLAY_NAME_PROPERTY));
    }

    if (claimProperties.containsKey(ClaimConstants.DESCRIPTION_PROPERTY)) {
        claim.setDescription(claimProperties.get(ClaimConstants.DESCRIPTION_PROPERTY));
    }

    if (claimProperties.containsKey(ClaimConstants.REGULAR_EXPRESSION_PROPERTY)) {
        claim.setRegEx(claimProperties.get(ClaimConstants.REGULAR_EXPRESSION_PROPERTY));
    }

    if (claimProperties.containsKey(ClaimConstants.DISPLAY_ORDER_PROPERTY)) {
        claim.setDisplayOrder(Integer.parseInt(claimProperties.get(ClaimConstants.DISPLAY_ORDER_PROPERTY)));
    }

    if (claimProperties.containsKey(ClaimConstants.SUPPORTED_BY_DEFAULT_PROPERTY)) {
        if ("false".equalsIgnoreCase(claimProperties.get(ClaimConstants.SUPPORTED_BY_DEFAULT_PROPERTY))) {
            claim.setSupportedByDefault(Boolean.FALSE);

        } else {
            claim.setSupportedByDefault(Boolean.TRUE);
        }
    }

    if (claimProperties.containsKey(ClaimConstants.REQUIRED_PROPERTY)) {
        if ("false".equalsIgnoreCase(claimProperties.get(ClaimConstants.REQUIRED_PROPERTY))) {
            claim.setRequired(Boolean.FALSE);

        } else {
            claim.setRequired(Boolean.TRUE);
        }
    }

    if (claimProperties.containsKey(ClaimConstants.READ_ONLY_PROPERTY)) {
        if ("false".equalsIgnoreCase(claimProperties.get(ClaimConstants.READ_ONLY_PROPERTY))) {
            claim.setReadOnly(Boolean.FALSE);

        } else {
            claim.setReadOnly(Boolean.TRUE);
        }
    }

    claimMapping.setClaim(claim);

    List<AttributeMapping> mappedAttributes = localClaim.getMappedAttributes();
    for (AttributeMapping attributeMapping : mappedAttributes) {
        claimMapping.setMappedAttribute(attributeMapping.getUserStoreDomain(), attributeMapping.getAttributeName());
    }

    if (claimProperties.containsKey(ClaimConstants.DEFAULT_ATTRIBUTE)) {
        claimMapping.setMappedAttribute(claimProperties.get(ClaimConstants.DEFAULT_ATTRIBUTE));
    } else {
        RealmService realmService = IdentityClaimManagementServiceDataHolder.getInstance().getRealmService();

        if (realmService != null && realmService.getTenantUserRealm(tenantId) != null) {

            UserRealm realm = realmService.getTenantUserRealm(tenantId);
            String primaryDomainName = realm.getRealmConfiguration().getUserStoreProperty
                    (UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME);
            claimMapping.setMappedAttribute(localClaim.getMappedAttribute(primaryDomainName));
        } else {
            claimMapping.setMappedAttribute(localClaim.getMappedAttribute(UserCoreConstants.
                    PRIMARY_DEFAULT_DOMAIN_NAME));
        }
    }

    return claimMapping;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:81,代码来源:ClaimMetadataUtils.java

示例4: testConvertLocalClaimToClaimMapping

import org.wso2.carbon.user.core.claim.ClaimMapping; //导入依赖的package包/类
@Test(dataProvider = "Authentication")
public void testConvertLocalClaimToClaimMapping(LocalClaim localClaim) throws Exception {

    ClaimMapping claimMapping = ClaimMetadataUtils.convertLocalClaimToClaimMapping(localClaim, -1234);

    Assert.assertEquals(claimMapping.getClaim().getDialectURI(), localClaim.getClaimDialectURI());
    Assert.assertEquals(claimMapping.getClaim().getClaimUri(), localClaim.getClaimURI());

    Map<String, String> claimProperties = localClaim.getClaimProperties();

    if (claimProperties.containsKey(ClaimConstants.DISPLAY_NAME_PROPERTY)) {
        Assert.assertEquals(claimMapping.getClaim().getDisplayTag(), claimProperties.get(ClaimConstants.
                DISPLAY_NAME_PROPERTY));
    }

    if (claimProperties.containsKey(ClaimConstants.DESCRIPTION_PROPERTY)) {
        Assert.assertEquals(claimMapping.getClaim().getDescription(), claimProperties.get(ClaimConstants.
                DESCRIPTION_PROPERTY));
    }

    if (claimProperties.containsKey(ClaimConstants.REGULAR_EXPRESSION_PROPERTY)) {
        Assert.assertEquals(claimMapping.getClaim().getRegEx(), claimProperties.get(ClaimConstants.
                REGULAR_EXPRESSION_PROPERTY));
    }

    if (claimProperties.containsKey(ClaimConstants.DISPLAY_ORDER_PROPERTY)) {
        Assert.assertEquals(claimMapping.getClaim().getDisplayOrder(), Integer.parseInt(claimProperties.get(
                ClaimConstants.DISPLAY_ORDER_PROPERTY)));
    }

    if (claimProperties.containsKey(ClaimConstants.SUPPORTED_BY_DEFAULT_PROPERTY)) {
        Assert.assertEquals(claimMapping.getClaim().isSupportedByDefault(), Boolean.parseBoolean(claimProperties.
                get(ClaimConstants.SUPPORTED_BY_DEFAULT_PROPERTY)));
    }

    if (claimProperties.containsKey(ClaimConstants.REQUIRED_PROPERTY)) {
        Assert.assertEquals(claimMapping.getClaim().isRequired(), Boolean.parseBoolean(claimProperties.get(
                ClaimConstants.REQUIRED_PROPERTY)));
    }

    if (claimProperties.containsKey(ClaimConstants.READ_ONLY_PROPERTY)) {
        Assert.assertEquals(claimMapping.getClaim().isReadOnly(), Boolean.parseBoolean(claimProperties.get(
                ClaimConstants.READ_ONLY_PROPERTY)));
    }

    for (AttributeMapping attributeMapping : localClaim.getMappedAttributes()) {
        Assert.assertEquals(claimMapping.getMappedAttribute(attributeMapping.getUserStoreDomain()),
                attributeMapping.getAttributeName());
    }

}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:52,代码来源:ClaimMetadataUtilsTest.java

示例5: testConvertExternalClaimToClaimMapping

import org.wso2.carbon.user.core.claim.ClaimMapping; //导入依赖的package包/类
@Test
public void testConvertExternalClaimToClaimMapping() throws Exception {

    List<LocalClaim> localClaimList = Arrays.asList(localClaims);
    ClaimMapping claimMapping = ClaimMetadataUtils.convertExternalClaimToClaimMapping(externalClaim, localClaimList, -1234);

    Assert.assertEquals(claimMapping.getClaim().getDialectURI(), externalClaim.getClaimDialectURI());
    Assert.assertEquals(claimMapping.getClaim().getClaimUri(), externalClaim.getClaimURI());

    Map<String, String> claimProperties = localClaim2.getClaimProperties();

    if (claimProperties.containsKey(ClaimConstants.DISPLAY_NAME_PROPERTY)) {
        Assert.assertEquals(claimMapping.getClaim().getDisplayTag(), claimProperties.get(ClaimConstants.
                DISPLAY_NAME_PROPERTY));
    }

    if (claimProperties.containsKey(ClaimConstants.DESCRIPTION_PROPERTY)) {
        Assert.assertEquals(claimMapping.getClaim().getDescription(), claimProperties.get(ClaimConstants.
                DESCRIPTION_PROPERTY));
    }

    if (claimProperties.containsKey(ClaimConstants.REGULAR_EXPRESSION_PROPERTY)) {
        Assert.assertEquals(claimMapping.getClaim().getRegEx(), claimProperties.get(ClaimConstants.
                REGULAR_EXPRESSION_PROPERTY));
    }

    if (claimProperties.containsKey(ClaimConstants.DISPLAY_ORDER_PROPERTY)) {
        Assert.assertEquals(claimMapping.getClaim().getDisplayOrder(), Integer.parseInt(claimProperties.get(
                ClaimConstants.DISPLAY_ORDER_PROPERTY)));
    }

    if (claimProperties.containsKey(ClaimConstants.SUPPORTED_BY_DEFAULT_PROPERTY)) {
        Assert.assertEquals(claimMapping.getClaim().isSupportedByDefault(), Boolean.parseBoolean(claimProperties.
                get(ClaimConstants.SUPPORTED_BY_DEFAULT_PROPERTY)));
    }

    if (claimProperties.containsKey(ClaimConstants.REQUIRED_PROPERTY)) {
        Assert.assertEquals(claimMapping.getClaim().isRequired(), Boolean.parseBoolean(claimProperties.get(
                ClaimConstants.REQUIRED_PROPERTY)));
    }

    if (claimProperties.containsKey(ClaimConstants.READ_ONLY_PROPERTY)) {
        Assert.assertEquals(claimMapping.getClaim().isReadOnly(), Boolean.parseBoolean(claimProperties.get(
                ClaimConstants.READ_ONLY_PROPERTY)));
    }

    for (AttributeMapping attributeMapping : localClaim2.getMappedAttributes()) {
        Assert.assertEquals(claimMapping.getMappedAttribute(attributeMapping.getUserStoreDomain()),
                attributeMapping.getAttributeName());
    }

    ClaimMapping claimMapping2 = ClaimMetadataUtils.convertExternalClaimToClaimMapping(externalClaim, null, -1234);

    Assert.assertEquals(claimMapping2.getClaim().getDialectURI(), externalClaim.getClaimDialectURI());
    Assert.assertEquals(claimMapping2.getClaim().getClaimUri(), externalClaim.getClaimURI());

}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:58,代码来源:ClaimMetadataUtilsTest.java


注:本文中的org.wso2.carbon.user.core.claim.ClaimMapping类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。