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


Java ApplicationManagementService类代码示例

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


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

示例1: refreshAppConfig

import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; //导入依赖的package包/类
private void refreshAppConfig(SequenceConfig sequenceConfig, String clientId, String clientType, String
        tenantDomain) throws FrameworkException {

    try {
        ApplicationConfig appConfig = new ApplicationConfig(ApplicationManagementService.getInstance()
                .getServiceProviderByClientId(clientId, clientType, tenantDomain));
        sequenceConfig.setApplicationConfig(appConfig);
        if (log.isDebugEnabled()) {
            log.debug("Refresh application config in sequence config for application id: " + sequenceConfig
                    .getApplicationId() + " in tenant: " + tenantDomain);
        }
    } catch (IdentityApplicationManagementException e) {
        String message = "No application found for application id: " + sequenceConfig.getApplicationId() +
                " in tenant: " + tenantDomain + " Probably, the Service Provider would have been removed.";
        throw new FrameworkException(message, e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:18,代码来源:DefaultRequestCoordinator.java

示例2: activate

import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; //导入依赖的package包/类
@Activate
protected void activate(ComponentContext context) {
    try {
        bundleContext = context.getBundleContext();
        // Registering Application management service as a OSGIService
        bundleContext.registerService(ApplicationManagementService.class.getName(),
                ApplicationManagementServiceImpl.getInstance(), null);
        bundleContext.registerService(IdentityProviderMgtListener.class.getName(), new ApplicationIdentityProviderMgtListener(), null);
        bundleContext.registerService(ApplicationMgtListener.class.getName(), new ApplicationMgtValidationListener(), null);
        ApplicationMgtSystemConfig.getInstance();
        bundleContext.registerService(ApplicationMgtListener.class.getName(), new ApplicationMgtAuditLogger(),
                null);
        buildFileBasedSPList();

        if (log.isDebugEnabled()) {
            log.debug("Identity ApplicationManagementComponent bundle is activated");
        }
    } catch (Exception e) {
        log.error("Error while activating ApplicationManagementComponent bundle", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:22,代码来源:ApplicationManagementServiceComponent.java

示例3: activate

import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; //导入依赖的package包/类
protected void activate(ComponentContext context) {
    try {
        bundleContext = context.getBundleContext();
        // Registering Application management service as a OSGIService
        bundleContext.registerService(ApplicationManagementService.class.getName(),
                ApplicationManagementServiceImpl.getInstance(), null);
        bundleContext.registerService(IdentityProviderMgtListener.class.getName(), new ApplicationIdentityProviderMgtListener(), null);
        bundleContext.registerService(ApplicationMgtListener.class.getName(), new ApplicationMgtValidationListener(), null);
        ApplicationMgtSystemConfig.getInstance();
        bundleContext.registerService(ApplicationMgtListener.class.getName(), new ApplicationMgtAuditLogger(),
                null);
        buildFileBasedSPList();

        if (log.isDebugEnabled()) {
            log.debug("Identity ApplicationManagementComponent bundle is activated");
        }
    } catch (Exception e) {
        log.error("Error while activating ApplicationManagementComponent bundle", e);
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:21,代码来源:ApplicationManagementServiceComponent.java

示例4: getSubjectClaimUri

import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; //导入依赖的package包/类
private String getSubjectClaimUri(OAuthTokenReqMessageContext request) {
    ApplicationManagementService applicationMgtService = OAuth2ServiceComponentHolder
            .getApplicationMgtService();
    ServiceProvider serviceProvider = null;
    try {
        String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
        String spName = applicationMgtService.getServiceProviderNameByClientId(request.getOauth2AccessTokenReqDTO()
                                                                                       .getClientId(),
                                                                               INBOUND_AUTH2_TYPE, tenantDomain);
        serviceProvider = applicationMgtService.getApplicationExcludingFileBasedSPs(spName, tenantDomain);
        if (serviceProvider != null) {
            return serviceProvider.getLocalAndOutBoundAuthenticationConfig().getSubjectClaimUri();
        }
    } catch (IdentityApplicationManagementException ex) {
        log.error("Error while getting service provider information.", ex);
    }
    return null;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:19,代码来源:SAMLAssertionClaimsCallback.java

示例5: getUserStoreDomainFromSP

import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; //导入依赖的package包/类
private String getUserStoreDomainFromSP() throws IdentityApplicationManagementException {

        ThreadLocalProvisioningServiceProvider threadLocalSP = IdentityApplicationManagementUtil
                .getThreadLocalProvisioningServiceProvider();
        ServiceProvider serviceProvider = null;
        if (threadLocalSP.getServiceProviderType() == ProvisioningServiceProviderType.OAUTH) {
            serviceProvider = ApplicationManagementService.getInstance()
                                                          .getServiceProviderByClientId(
                                                                  threadLocalSP.getServiceProviderName(),
                                                                  "oauth2", threadLocalSP.getTenantDomain());
        } else {
            serviceProvider = ApplicationManagementService.getInstance().getServiceProvider(
                    threadLocalSP.getServiceProviderName(), threadLocalSP.getTenantDomain());
        }

        if (serviceProvider != null && serviceProvider.getInboundProvisioningConfig() != null &&
            !StringUtils.isBlank(serviceProvider.getInboundProvisioningConfig().getProvisioningUserStore())) {
            return serviceProvider.getInboundProvisioningConfig().getProvisioningUserStore();
        }
        return null;
    }
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:22,代码来源:SCIMUserManager.java

示例6: getServiceProvider

import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; //导入依赖的package包/类
private ServiceProvider getServiceProvider(boolean isBulkUserAdd) throws CharonException {

        ThreadLocalProvisioningServiceProvider threadLocalSP = IdentityApplicationManagementUtil
                .getThreadLocalProvisioningServiceProvider();
        //isBulkUserAdd is true indicates bulk user add
        if (isBulkUserAdd) {
            threadLocalSP.setBulkUserAdd(true);
        }
        try {
            if (threadLocalSP.getServiceProviderType() == ProvisioningServiceProviderType.OAUTH) {
                return ApplicationManagementService.getInstance().getServiceProviderByClientId(
                                                           threadLocalSP.getServiceProviderName(),
                                                           "oauth2", threadLocalSP.getTenantDomain());
            } else {
                return ApplicationManagementService.getInstance().getServiceProvider(
                        threadLocalSP.getServiceProviderName(), threadLocalSP.getTenantDomain());
            }
        } catch (IdentityApplicationManagementException e) {
            throw new CharonException("Error retrieving Service Provider. ", e);
        }
    }
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:22,代码来源:SCIMUserManager.java

示例7: setApplicationMgtService

import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; //导入依赖的package包/类
/**
 * Set Application management service implementation
 *
 * @param applicationMgtService Application management service
 */
protected void setApplicationMgtService(ApplicationManagementService applicationMgtService) {
    if (log.isDebugEnabled()) {
        log.debug("ApplicationManagementService set in Identity OAuth2ServiceComponent bundle");
    }
    OAuth2ServiceComponentHolder.setApplicationMgtService(applicationMgtService);
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:12,代码来源:OAuth2ServiceComponent.java

示例8: unsetApplicationMgtService

import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; //导入依赖的package包/类
/**
 * Unset Application management service implementation
 *
 * @param applicationMgtService Application management service
 */
protected void unsetApplicationMgtService(ApplicationManagementService applicationMgtService) {
    if (log.isDebugEnabled()) {
        log.debug("ApplicationManagementService unset in Identity OAuth2ServiceComponent bundle");
    }
    OAuth2ServiceComponentHolder.setApplicationMgtService(null);
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:12,代码来源:OAuth2ServiceComponent.java

示例9: doPreAddUser

import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; //导入依赖的package包/类
@Override
public boolean doPreAddUser(String userName, Object credential, String[] roleList,
                            Map<String, String> inboundAttributes, String profile, UserStoreManager userStoreManager)
        throws UserStoreException {
    if (!isEnable()) {
        return true;
    }

    Map<ClaimMapping, List<String>> outboundAttributes = new HashMap<>();

    if (credential != null) {
        outboundAttributes.put(ClaimMapping.build(
                        IdentityProvisioningConstants.PASSWORD_CLAIM_URI, null, null, false),
                Arrays.asList(new String[]{((StringBuffer) credential).toString()}));
    }

    if (userName != null) {
        outboundAttributes.put(ClaimMapping.build(
                        IdentityProvisioningConstants.USERNAME_CLAIM_URI, null, null, false),
                Arrays.asList(new String[]{userName}));
    }

    if (roleList != null) {
        outboundAttributes.put(ClaimMapping.build(
                IdentityProvisioningConstants.GROUP_CLAIM_URI, null, null, false), Arrays
                .asList(roleList));
    }

    String domainName = UserCoreUtil.getDomainName(userStoreManager.getRealmConfiguration());
    if (log.isDebugEnabled()) {
        log.debug("Adding domain name : " + domainName + " to user : " + userName);
    }
    String domainAwareName = UserCoreUtil.addDomainToName(userName, domainName);

    ProvisioningEntity provisioningEntity = new ProvisioningEntity(
            ProvisioningEntityType.USER, domainAwareName, ProvisioningOperation.POST,
            outboundAttributes);

    // set the in-bound attribute list.in this particular case this is in the wso2.org claim
    // dialect.
    provisioningEntity.setInboundAttributes(inboundAttributes);

    String tenantDomainName = CarbonContext.getThreadLocalCarbonContext().getTenantDomain();

    ThreadLocalProvisioningServiceProvider threadLocalServiceProvider;
    threadLocalServiceProvider = IdentityApplicationManagementUtil
            .getThreadLocalProvisioningServiceProvider();

    if (threadLocalServiceProvider != null) {

        String serviceProvider = threadLocalServiceProvider.getServiceProviderName();
        tenantDomainName = threadLocalServiceProvider.getTenantDomain();
        if (threadLocalServiceProvider.getServiceProviderType() == ProvisioningServiceProviderType.OAUTH) {
            try {
                serviceProvider = ApplicationManagementService.getInstance()
                        .getServiceProviderNameByClientId(
                                threadLocalServiceProvider.getServiceProviderName(),
                                IdentityApplicationConstants.OAuth2.NAME, tenantDomainName);
            } catch (IdentityApplicationManagementException e) {
                log.error("Error while provisioning", e);
                return true;
            }
        }

        // call framework method to provision the user.
        OutboundProvisioningManager.getInstance().provision(provisioningEntity,
                serviceProvider, threadLocalServiceProvider.getClaimDialect(),
                tenantDomainName, threadLocalServiceProvider.isJustInTimeProvisioning());
    } else {
        // call framework method to provision the user.
        OutboundProvisioningManager.getInstance()
                .provision(provisioningEntity, ApplicationConstants.LOCAL_SP,
                        IdentityProvisioningConstants.WSO2_CARBON_DIALECT, tenantDomainName, false);
    }

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

示例10: doPreSetUserClaimValues

import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; //导入依赖的package包/类
@Override
public boolean doPreSetUserClaimValues(String userName, Map<String, String> inboundAttributes,
                                       String profileName, UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    Map<ClaimMapping, List<String>> outboundAttributes = new HashMap<>();

    if (userName != null) {
        outboundAttributes.put(ClaimMapping.build(
                        IdentityProvisioningConstants.USERNAME_CLAIM_URI, null, null, false),
                Arrays.asList(new String[]{userName}));
    }

    String domainName = UserCoreUtil.getDomainName(userStoreManager.getRealmConfiguration());
    if (log.isDebugEnabled()) {
        log.debug("Adding domain name : " + domainName + " to user : " + userName);
    }
    String domainAwareName = UserCoreUtil.addDomainToName(userName, domainName);

    ProvisioningEntity provisioningEntity = new ProvisioningEntity(
            ProvisioningEntityType.USER, domainAwareName, ProvisioningOperation.PUT,
            outboundAttributes);

    // set the in-bound attribute list.
    provisioningEntity.setInboundAttributes(inboundAttributes);

    String tenantDomainName = CarbonContext.getThreadLocalCarbonContext().getTenantDomain();

    ThreadLocalProvisioningServiceProvider threadLocalServiceProvider;
    threadLocalServiceProvider = IdentityApplicationManagementUtil
            .getThreadLocalProvisioningServiceProvider();

    if (threadLocalServiceProvider != null) {

        String serviceProvider = threadLocalServiceProvider.getServiceProviderName();
        tenantDomainName = threadLocalServiceProvider.getTenantDomain();
        if (threadLocalServiceProvider.getServiceProviderType() == ProvisioningServiceProviderType.OAUTH) {
            try {
                serviceProvider = ApplicationManagementService.getInstance()
                        .getServiceProviderNameByClientId(
                                threadLocalServiceProvider.getServiceProviderName(),
                                IdentityApplicationConstants.OAuth2.NAME, tenantDomainName);
            } catch (IdentityApplicationManagementException e) {
                log.error("Error while provisioning", e);
                return true;
            }
        }

        // call framework method to provision the user.
        OutboundProvisioningManager.getInstance().provision(provisioningEntity,
                serviceProvider, threadLocalServiceProvider.getClaimDialect(),
                tenantDomainName, threadLocalServiceProvider.isJustInTimeProvisioning());
    } else {
        // call framework method to provision the user.
        OutboundProvisioningManager.getInstance()
                .provision(provisioningEntity, ApplicationConstants.LOCAL_SP,
                        IdentityProvisioningConstants.WSO2_CARBON_DIALECT, tenantDomainName, false);
    }

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

示例11: doPreDeleteUserClaimValues

import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; //导入依赖的package包/类
@Override
public boolean doPreDeleteUserClaimValues(String userName, String[] attributesToDelete,
                                          String profileName, UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable() || ArrayUtils.isEmpty(attributesToDelete)) {
        return true;
    }

    Map<ClaimMapping, List<String>> outboundAttributes = new HashMap<>();

    if (userName != null) {
        outboundAttributes.put(ClaimMapping.build(
                        IdentityProvisioningConstants.USERNAME_CLAIM_URI, null, null, false),
                Arrays.asList(new String[]{userName}));
    }

    String domainName = UserCoreUtil.getDomainName(userStoreManager.getRealmConfiguration());
    if (log.isDebugEnabled()) {
        log.debug("Adding domain name : " + domainName + " to user : " + userName);
    }
    String domainAwareName = UserCoreUtil.addDomainToName(userName, domainName);

    ProvisioningEntity provisioningEntity = new ProvisioningEntity(
            ProvisioningEntityType.USER, domainAwareName, ProvisioningOperation.PATCH,
            outboundAttributes);

    Map<String, String> inboundAttributes = new HashMap<>();
    for (int i = 0; i < attributesToDelete.length; i++) {
        inboundAttributes.put(attributesToDelete[i], "");
    }
    ;
    // set the in-bound attribute list.
    provisioningEntity.setInboundAttributes(inboundAttributes);

    String tenantDomainName = CarbonContext.getThreadLocalCarbonContext().getTenantDomain();

    ThreadLocalProvisioningServiceProvider threadLocalServiceProvider;
    threadLocalServiceProvider = IdentityApplicationManagementUtil
            .getThreadLocalProvisioningServiceProvider();

    if (threadLocalServiceProvider != null) {

        String serviceProvider = threadLocalServiceProvider.getServiceProviderName();
        tenantDomainName = threadLocalServiceProvider.getTenantDomain();
        if (threadLocalServiceProvider.getServiceProviderType() == ProvisioningServiceProviderType.OAUTH) {
            try {
                serviceProvider = ApplicationManagementService.getInstance()
                        .getServiceProviderNameByClientId(
                                threadLocalServiceProvider.getServiceProviderName(),
                                IdentityApplicationConstants.OAuth2.NAME, tenantDomainName);
            } catch (IdentityApplicationManagementException e) {
                log.error("Error while provisioning", e);
                return true;
            }
        }

        // call framework method to provision the user.
        OutboundProvisioningManager.getInstance().provision(provisioningEntity,
                serviceProvider, threadLocalServiceProvider.getClaimDialect(),
                tenantDomainName, threadLocalServiceProvider.isJustInTimeProvisioning());
    } else {
        // call framework method to provision the user.
        OutboundProvisioningManager.getInstance()
                .provision(provisioningEntity, ApplicationConstants.LOCAL_SP,
                        IdentityProvisioningConstants.WSO2_CARBON_DIALECT, tenantDomainName, false);
    }

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

示例12: doPreDeleteUserClaimValue

import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; //导入依赖的package包/类
@Override
public boolean doPreDeleteUserClaimValue(String userName, String attributeToDelete, String profileName,
                                         UserStoreManager userStoreManager) throws UserStoreException {
    if (!isEnable()) {
        return true;
    }
    Map<ClaimMapping, List<String>> outboundAttributes = new HashMap<>();

    if (userName != null) {
        outboundAttributes.put(ClaimMapping.build(
                        IdentityProvisioningConstants.USERNAME_CLAIM_URI, null, null, false),
                Arrays.asList(new String[]{userName}));
    }

    String domainName = UserCoreUtil.getDomainName(userStoreManager.getRealmConfiguration());
    if (log.isDebugEnabled()) {
        log.debug("Adding domain name : " + domainName + " to user : " + userName);
    }
    String domainAwareName = UserCoreUtil.addDomainToName(userName, domainName);

    ProvisioningEntity provisioningEntity = new ProvisioningEntity(
            ProvisioningEntityType.USER, domainAwareName, ProvisioningOperation.PATCH,
            outboundAttributes);

    Map<String, String> inboundAttributes = new HashMap<>();
    inboundAttributes.put(attributeToDelete, "");

    // set the in-bound attribute list.
    provisioningEntity.setInboundAttributes(inboundAttributes);

    String tenantDomainName = CarbonContext.getThreadLocalCarbonContext().getTenantDomain();

    ThreadLocalProvisioningServiceProvider threadLocalServiceProvider;
    threadLocalServiceProvider = IdentityApplicationManagementUtil
            .getThreadLocalProvisioningServiceProvider();

    if (threadLocalServiceProvider != null) {

        String serviceProvider = threadLocalServiceProvider.getServiceProviderName();
        tenantDomainName = threadLocalServiceProvider.getTenantDomain();
        if (threadLocalServiceProvider.getServiceProviderType() == ProvisioningServiceProviderType.OAUTH) {
            try {
                serviceProvider = ApplicationManagementService.getInstance()
                        .getServiceProviderNameByClientId(
                                threadLocalServiceProvider.getServiceProviderName(),
                                IdentityApplicationConstants.OAuth2.NAME, tenantDomainName);
            } catch (IdentityApplicationManagementException e) {
                log.error("Error while provisioning", e);
                return true;
            }
        }

        // call framework method to provision the user.
        OutboundProvisioningManager.getInstance().provision(provisioningEntity,
                serviceProvider, threadLocalServiceProvider.getClaimDialect(),
                tenantDomainName, threadLocalServiceProvider.isJustInTimeProvisioning());
    } else {
        // call framework method to provision the user.
        OutboundProvisioningManager.getInstance()
                .provision(provisioningEntity, ApplicationConstants.LOCAL_SP,
                        IdentityProvisioningConstants.WSO2_CARBON_DIALECT, tenantDomainName, false);
    }

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

示例13: doPreDeleteUser

import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; //导入依赖的package包/类
@Override
public boolean doPreDeleteUser(String userName, UserStoreManager userStoreManager)
        throws UserStoreException {
    if (!isEnable()) {
        return true;
    }

    Map<ClaimMapping, List<String>> outboundAttributes = new HashMap<>();

    outboundAttributes.put(ClaimMapping.build(
            IdentityProvisioningConstants.USERNAME_CLAIM_URI, null, null, false), Arrays
            .asList(new String[]{userName}));

    String domainName = UserCoreUtil.getDomainName(userStoreManager.getRealmConfiguration());
    if (log.isDebugEnabled()) {
        log.debug("Adding domain name : " + domainName + " to user : " + userName);
    }
    String domainAwareName = UserCoreUtil.addDomainToName(userName, domainName);

    ProvisioningEntity provisioningEntity = new ProvisioningEntity(
            ProvisioningEntityType.USER, domainAwareName, ProvisioningOperation.DELETE,
            outboundAttributes);

    String tenantDomainName = CarbonContext.getThreadLocalCarbonContext().getTenantDomain();

    ThreadLocalProvisioningServiceProvider threadLocalServiceProvider;
    threadLocalServiceProvider = IdentityApplicationManagementUtil
            .getThreadLocalProvisioningServiceProvider();

    if (threadLocalServiceProvider != null) {
        String serviceProvider = threadLocalServiceProvider.getServiceProviderName();
        tenantDomainName = threadLocalServiceProvider.getTenantDomain();
        if (threadLocalServiceProvider.getServiceProviderType() == ProvisioningServiceProviderType.OAUTH) {
            try {
                serviceProvider = ApplicationManagementService.getInstance()
                        .getServiceProviderNameByClientId(
                                threadLocalServiceProvider.getServiceProviderName(),
                                IdentityApplicationConstants.OAuth2.NAME, tenantDomainName);
            } catch (IdentityApplicationManagementException e) {
                log.error("Error while provisioning", e);
                return true;
            }
        }

        // call framework method to provision the user.
        OutboundProvisioningManager.getInstance().provision(provisioningEntity,
                serviceProvider, threadLocalServiceProvider.getClaimDialect(),
                tenantDomainName, threadLocalServiceProvider.isJustInTimeProvisioning());
    } else {
        OutboundProvisioningManager.getInstance()
                .provision(provisioningEntity, ApplicationConstants.LOCAL_SP,
                        IdentityProvisioningConstants.WSO2_CARBON_DIALECT, tenantDomainName, false);
    }

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

示例14: doPostUpdateUserListOfRole

import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; //导入依赖的package包/类
@Override
public boolean doPostUpdateUserListOfRole(String roleName, String[] deletedUsers,
                                          String[] newUsers, UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    String[] userList = userStoreManager.getUserListOfRole(roleName);

    Map<ClaimMapping, List<String>> outboundAttributes = new HashMap<>();

    outboundAttributes.put(ClaimMapping.build(
            IdentityProvisioningConstants.GROUP_CLAIM_URI, null, null, false), Arrays
            .asList(new String[]{roleName}));

    outboundAttributes.put(ClaimMapping.build(IdentityProvisioningConstants.USERNAME_CLAIM_URI,
            null, null, false), Arrays.asList(userList));

    outboundAttributes.put(ClaimMapping.build(
            IdentityProvisioningConstants.NEW_USER_CLAIM_URI, null, null, false), Arrays
            .asList(newUsers));

    outboundAttributes.put(ClaimMapping.build(
                    IdentityProvisioningConstants.DELETED_USER_CLAIM_URI, null, null, false),
            Arrays.asList(deletedUsers));

    String domainName = UserCoreUtil.getDomainName(userStoreManager.getRealmConfiguration());
    if (log.isDebugEnabled()) {
        log.debug("Adding domain name : " + domainName + " to role : " + roleName);
    }
    String domainAwareName = UserCoreUtil.addDomainToName(roleName, domainName);

    ProvisioningEntity provisioningEntity = new ProvisioningEntity(
            ProvisioningEntityType.GROUP, domainAwareName, ProvisioningOperation.PUT,
            outboundAttributes);

    String tenantDomainName = CarbonContext.getThreadLocalCarbonContext().getTenantDomain();

    ThreadLocalProvisioningServiceProvider threadLocalServiceProvider;
    threadLocalServiceProvider = IdentityApplicationManagementUtil
            .getThreadLocalProvisioningServiceProvider();

    if (threadLocalServiceProvider != null) {
        String serviceProvider = threadLocalServiceProvider.getServiceProviderName();
        tenantDomainName = threadLocalServiceProvider.getTenantDomain();
        if (threadLocalServiceProvider.getServiceProviderType() == ProvisioningServiceProviderType.OAUTH) {
            try {
                serviceProvider = ApplicationManagementService.getInstance()
                        .getServiceProviderNameByClientId(
                                threadLocalServiceProvider.getServiceProviderName(),
                                IdentityApplicationConstants.OAuth2.NAME, tenantDomainName);
            } catch (IdentityApplicationManagementException e) {
                log.error("Error while provisioning", e);
                return true;
            }
        }

        // call framework method to provision the user.
        OutboundProvisioningManager.getInstance().provision(provisioningEntity,
                serviceProvider, threadLocalServiceProvider.getClaimDialect(),
                tenantDomainName, threadLocalServiceProvider.isJustInTimeProvisioning());
    } else {
        // call framework method to provision the group.
        OutboundProvisioningManager.getInstance()
                .provision(provisioningEntity, ApplicationConstants.LOCAL_SP,
                        IdentityProvisioningConstants.WSO2_CARBON_DIALECT, tenantDomainName, false);
    }

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

示例15: doPreAddRole

import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; //导入依赖的package包/类
@Override
public boolean doPreAddRole(String roleName, String[] userList, Permission[] permissions,
                            UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }
    Map<ClaimMapping, List<String>> outboundAttributes = new HashMap<>();

    if (roleName != null) {
        outboundAttributes.put(ClaimMapping.build(
                IdentityProvisioningConstants.GROUP_CLAIM_URI, null, null, false), Arrays
                .asList(new String[]{roleName}));
    }

    if (userList != null && userList.length > 0) {
        outboundAttributes.put(ClaimMapping.build(
                IdentityProvisioningConstants.USERNAME_CLAIM_URI, null, null, false), Arrays
                .asList(userList));
    }

    String domainName = UserCoreUtil.getDomainName(userStoreManager.getRealmConfiguration());
    if (log.isDebugEnabled()) {
        log.debug("Adding domain name : " + domainName + " to user : " + roleName);
    }
    String domainAwareName = UserCoreUtil.addDomainToName(roleName, domainName);

    ProvisioningEntity provisioningEntity = new ProvisioningEntity(
            ProvisioningEntityType.GROUP, domainAwareName, ProvisioningOperation.POST,
            outboundAttributes);

    String tenantDomainName = CarbonContext.getThreadLocalCarbonContext().getTenantDomain();

    ThreadLocalProvisioningServiceProvider threadLocalServiceProvider;
    threadLocalServiceProvider = IdentityApplicationManagementUtil
            .getThreadLocalProvisioningServiceProvider();

    if (threadLocalServiceProvider != null) {
        String serviceProvider = threadLocalServiceProvider.getServiceProviderName();
        tenantDomainName = threadLocalServiceProvider.getTenantDomain();
        if (threadLocalServiceProvider.getServiceProviderType() == ProvisioningServiceProviderType.OAUTH) {
            try {
                serviceProvider = ApplicationManagementService.getInstance()
                        .getServiceProviderNameByClientId(
                                threadLocalServiceProvider.getServiceProviderName(),
                                IdentityApplicationConstants.OAuth2.NAME, tenantDomainName);
            } catch (IdentityApplicationManagementException e) {
                log.error("Error while provisioning", e);
                return true;
            }
        }

        // call framework method to provision the user.
        OutboundProvisioningManager.getInstance().provision(provisioningEntity,
                serviceProvider, threadLocalServiceProvider.getClaimDialect(),
                tenantDomainName, threadLocalServiceProvider.isJustInTimeProvisioning());
    } else {
        // call framework method to provision the group.
        OutboundProvisioningManager.getInstance()
                .provision(provisioningEntity, ApplicationConstants.LOCAL_SP,
                        IdentityProvisioningConstants.WSO2_CARBON_DIALECT, tenantDomainName, false);
    }

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


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