Package org.wso2.carbon.user.core

Examples of org.wso2.carbon.user.core.UserRealm


            throws Exception {
        // get the system registry for the tenant
        RealmConfiguration realmConfig = TenantMgtServiceComponent.getBootstrapRealmConfiguration();
        TenantMgtConfiguration tenantMgtConfiguration =
                TenantMgtServiceComponent.getRealmService().getTenantMgtConfiguration();
        UserRealm userRealm;
        try {
            MultiTenantRealmConfigBuilder builder =
                    TenantMgtServiceComponent.getRealmService().
                            getMultiTenantRealmConfigBuilder();
            RealmConfiguration realmConfigToPersist =
                    builder.getRealmConfigForTenantToPersist(realmConfig, tenantMgtConfiguration,
                                                             tenant,
                                                             tenantId);

            RealmConfiguration realmConfigToCreate =
                    builder.
                            getRealmConfigForTenantToCreateRealmOnTenantCreation(realmConfig,
                                                                                 realmConfigToPersist,
                                                                                 tenantId);
            userRealm =
                    TenantMgtServiceComponent.getRealmService().
                            getUserRealm(realmConfigToCreate);
        } catch (UserStoreException e) {
            String msg = "Error in creating Realm for tenant, tenant domain: " + tenant.getDomain();
            log.error(msg, e);
            throw new Exception(msg, e);
        }

        UserStoreManager userStoreManager;
        try {
            userStoreManager = userRealm.getUserStoreManager();

            return userStoreManager;
        } catch (UserStoreException e) {
            String msg = "Error in getting the userstore/authorization manager for tenant: " +
                         tenant.getDomain();
View Full Code Here


                throw new Exception(msg, e);
            }
            tenant.setEmail(tenantInfoBean.getEmail());
        }

        UserRealm userRealm = configSystemRegistry.getUserRealm();
        try {
            userStoreManager = userRealm.getUserStoreManager();
        } catch (UserStoreException e) {
            String msg = "Error in getting the user store manager for tenant, tenant domain: " +
                         tenantDomain + ".";
            log.error(msg, e);
            throw new Exception(msg, e);
View Full Code Here

        if (tenantInfoBean.getAdminPassword() != null
            && !tenantInfoBean.getAdminPassword().equals("")) {
            updatePassword = true;
        }

        UserRealm userRealm = configSystemRegistry.getUserRealm();
        try {
            userStoreManager = userRealm.getUserStoreManager();
        } catch (UserStoreException e) {
            String msg = "Error in getting the user store manager for tenant, tenant domain: " +
                         tenantDomain + ".";
            log.error(msg, e);
            throw new Exception(msg, e);
View Full Code Here

        }
        return capacity;
    }

    public int getCurrentUserCount(int tenantId) throws RegistryException {
        UserRealm userRealm = registryService.getUserRealm(tenantId);
        int usersCount;
        try {
            String[] users = userRealm.getUserStoreManager().listUsers("*", -1);
            usersCount = users.length;
        } catch (UserStoreException e) {
            String msg = "Error in getting the current users.";
            log.error(msg, e);
            throw new RegistryException(msg, e);
View Full Code Here

        }
    }

    private ClaimManager getClaimManager() throws UserStoreException {
        try {
            UserRealm realm = super.getUserRealm();
            if (realm == null) {
                throw new UserStoreException("UserRealm is null");
            }
            return realm.getClaimManager();
        } catch (Exception e) {
            throw new UserStoreException(e);
        }
    }
View Full Code Here

            EventBrokerService broker = CarbonEventBroker.getInstance();
            broker.getSubscriptionManager().deleteSecureTopic(topicName);
           
//            UserRegistry systemRegistry = EventBrokerServiceComponent.getConfigurationRegistry();
//           
            UserRealm userRealm = AdminServicesUtil.getUserRealm();
            AuthorizationManager authorizationManager = userRealm.getAuthorizationManager();
//           
//            //make sure storage location is available
//            if(!systemRegistry.resourceExists(SECURE_TOPIC_STORAGE)){
//                Resource resource = systemRegistry.newCollection();
//                systemRegistry.put(SECURE_TOPIC_STORAGE, resource);
View Full Code Here

            if(!owner.equals(getLoggedInUserName())){
                throw new AxisFault("Permission denied " +getLoggedInUserName() + " cannot access "+ topicName);
            }

           
            UserRealm userRealm = AdminServicesUtil.getUserRealm();
            //UserRealm userRealm = getUserRegistry().getUserRealm();
            AuthorizationManager authorizationManager = userRealm
                    .getAuthorizationManager();

            String path = getSecureTopicPermissionPath(topicName);
            if (accessibleUsers != null) {
                for (String accessibleUser : accessibleUsers) {
View Full Code Here

            if(!owner.equals(getLoggedInUserName())){
                throw new AxisFault("Permission denied " +getLoggedInUserName() + " cannot access "+ topicName);
            }
           
            //UserRealm userRealm = getUserRegistry().getUserRealm();
            UserRealm userRealm = AdminServicesUtil.getUserRealm();
            AuthorizationManager authorizationManager = userRealm
                    .getAuthorizationManager();
           
            String resourceName = getSecureTopicPermissionPath(topicName);
           
            if (accessibleUsers != null) {
View Full Code Here

            dispatchResponse(soapEnvelope, CommandBuilderConstants.WSA_FAULT, mc, true);
        }
       
        String topicName = subscription.getFilterDesc().getFilterValue();
        if(EventBrokerUtils.isSecureTopic(topicName)){
            UserRealm userRealm = AdminServicesUtil.getUserRealm();
            if(!userRealm.getAuthorizationManager().isUserAuthorized(EventBrokerUtils.getLoggedInUserName(),
                    Utils.getSecureTopicPermissionPath(topicName), "write")){
                throw new EventException("User is not authorized to subscribe to Secure topic "+ topicName);
            }
        }
       
View Full Code Here

import org.wso2.carbon.user.core.service.RealmService;

public class UserRealmService extends AbstractAdmin {

    public RealmConfigurationDTO getRealmConfiguration() throws UserStoreException {
        UserRealm userRealm = getApplicableUserRealm();
        RealmConfiguration realmConfig = userRealm.getRealmConfiguration();
        RealmConfigurationDTO realmConfigDTO = new RealmConfigurationDTO();
        realmConfigDTO.setRealmClassName(realmConfig.getRealmClassName());
        realmConfigDTO.setUserStoreClass(realmConfig.getUserStoreClass());
        realmConfigDTO.setAuthorizationManagerClass(realmConfig.getAuthorizationManagerClass());
        realmConfigDTO.setAdminRoleName(realmConfig.getAdminRoleName());
View Full Code Here

TOP

Related Classes of org.wso2.carbon.user.core.UserRealm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.