Search in sources :

Example 1 with UserRealmInfo

use of org.wso2.carbon.user.mgt.common.UserRealmInfo in project carbon-identity-framework by wso2.

the class UserAndRoleManagementServlet method doPost.

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String category = request.getParameter(CATEGORY);
    HttpSession session = request.getSession();
    if (USERS.equals(category)) {
        boolean error = false;
        boolean newFilter = false;
        boolean doUserList = true;
        boolean showFilterMessage = false;
        boolean multipleUserStores = false;
        String forwardTo = "user-mgt.jsp";
        FlaggedName[] datas = null;
        FlaggedName exceededDomains = null;
        String[] claimUris = null;
        FlaggedName[] users = null;
        String[] domainNames = null;
        int pageNumber = 0;
        int cachePages = 3;
        int noOfPageLinksToDisplay = 5;
        int numberOfPages = 0;
        Map<Integer, PaginatedNamesBean> flaggedNameMap = null;
        String BUNDLE = "org.wso2.carbon.userstore.ui.i18n.Resources";
        ResourceBundle resourceBundle = ResourceBundle.getBundle(BUNDLE, request.getLocale());
        // remove session data
        session.removeAttribute("userBean");
        session.removeAttribute(UserAdminUIConstants.USER_DISPLAY_NAME);
        session.removeAttribute(UserAdminUIConstants.USER_LIST_UNASSIGNED_ROLE_CACHE);
        session.removeAttribute(UserAdminUIConstants.USER_LIST_UNASSIGNED_ROLE_CACHE_EXCEEDED);
        session.removeAttribute(UserAdminUIConstants.USER_LIST_ASSIGNED_ROLE_CACHE);
        session.removeAttribute(UserAdminUIConstants.USER_LIST_ASSIGNED_ROLE_CACHE_EXCEEDED);
        session.removeAttribute(UserAdminUIConstants.USER_LIST_ADD_USER_ROLE_CACHE);
        session.removeAttribute(UserAdminUIConstants.USER_LIST_ADD_USER_ROLE_CACHE_EXCEEDED);
        session.removeAttribute(UserAdminUIConstants.USER_LIST_ASSIGN_ROLE_FILTER);
        session.removeAttribute(UserAdminUIConstants.USER_LIST_UNASSIGNED_ROLE_FILTER);
        session.removeAttribute(UserAdminUIConstants.USER_LIST_VIEW_ROLE_FILTER);
        session.removeAttribute(UserAdminUIConstants.USER_LIST_CACHE);
        // retrieve session attributes
        UserRealmInfo userRealmInfo = (UserRealmInfo) session.getAttribute(UserAdminUIConstants.USER_STORE_INFO);
        if (userRealmInfo != null) {
            multipleUserStores = userRealmInfo.getMultipleUserStore();
        }
        java.lang.String errorAttribute = (java.lang.String) session.getAttribute(UserAdminUIConstants.DO_USER_LIST);
        String claimUri = request.getParameter("claimUri");
        if (claimUri == null || claimUri.length() == 0) {
            claimUri = (java.lang.String) session.getAttribute(UserAdminUIConstants.USER_CLAIM_FILTER);
        }
        session.setAttribute(UserAdminUIConstants.USER_CLAIM_FILTER, claimUri);
        exceededDomains = (FlaggedName) session.getAttribute(UserAdminUIConstants.USER_LIST_CACHE_EXCEEDED);
        // search filter
        String selectedDomain = request.getParameter(DOMAIN);
        if (selectedDomain == null || selectedDomain.trim().length() == 0) {
            selectedDomain = (String) session.getAttribute(UserAdminUIConstants.USER_LIST_DOMAIN_FILTER);
            if (selectedDomain == null || selectedDomain.trim().length() == 0) {
                selectedDomain = UserAdminUIConstants.ALL_DOMAINS;
            }
        } else {
            newFilter = true;
        }
        session.setAttribute(UserAdminUIConstants.USER_LIST_DOMAIN_FILTER, selectedDomain.trim());
        String filter = request.getParameter(UserAdminUIConstants.USER_LIST_FILTER);
        if (filter == null || filter.trim().length() == 0) {
            /*filter = (java.lang.String) session.getAttribute(UserAdminUIConstants.USER_LIST_FILTER);
            if (filter == null || filter.trim().length() == 0) {
                filter = "*";
            }*/
            filter = "*";
        } else {
            if (filter.contains(UserAdminUIConstants.DOMAIN_SEPARATOR)) {
                selectedDomain = UserAdminUIConstants.ALL_DOMAINS;
                session.removeAttribute(UserAdminUIConstants.USER_LIST_DOMAIN_FILTER);
            }
            newFilter = true;
        }
        String userDomainSelector;
        String modifiedFilter = filter.trim();
        if (!UserAdminUIConstants.ALL_DOMAINS.equalsIgnoreCase(selectedDomain)) {
            modifiedFilter = selectedDomain + UserAdminUIConstants.DOMAIN_SEPARATOR + filter;
            modifiedFilter = modifiedFilter.trim();
            userDomainSelector = selectedDomain + UserAdminUIConstants.DOMAIN_SEPARATOR + "*";
        } else {
            userDomainSelector = "*";
        }
        session.setAttribute(UserAdminUIConstants.USER_LIST_FILTER, filter.trim());
        // check page number
        String pageNumberStr = request.getParameter("pageNumber");
        if (pageNumberStr == null) {
            pageNumberStr = "0";
        }
        if (userRealmInfo != null) {
            claimUris = userRealmInfo.getRequiredUserClaims();
        }
        try {
            pageNumber = Integer.parseInt(pageNumberStr);
        } catch (NumberFormatException ignored) {
        // page number format exception
        }
        flaggedNameMap = (Map<Integer, PaginatedNamesBean>) session.getAttribute(UserAdminUIConstants.USER_LIST_CACHE);
        if (flaggedNameMap != null) {
            PaginatedNamesBean bean = flaggedNameMap.get(pageNumber);
            if (bean != null) {
                users = bean.getNames();
                if (users != null && users.length > 0) {
                    numberOfPages = bean.getNumberOfPages();
                    doUserList = false;
                }
            }
        }
        if (errorAttribute != null) {
            error = true;
            session.removeAttribute(UserAdminUIConstants.DO_USER_LIST);
        }
        if ((doUserList || newFilter) && !error) {
            // don't call the back end if some kind of message is showing
            try {
                java.lang.String cookie = (java.lang.String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
                java.lang.String backendServerURL = CarbonUIUtil.getServerURL(getServletConfig().getServletContext(), session);
                ConfigurationContext configContext = (ConfigurationContext) getServletConfig().getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
                UserAdminClient client = new UserAdminClient(cookie, backendServerURL, configContext);
                if (userRealmInfo == null) {
                    userRealmInfo = client.getUserRealmInfo();
                    session.setAttribute(UserAdminUIConstants.USER_STORE_INFO, userRealmInfo);
                }
                if (userRealmInfo != null) {
                    claimUris = userRealmInfo.getRequiredUserClaims();
                }
                if (filter.length() > 0) {
                    if (claimUri != null && !"select".equalsIgnoreCase(claimUri)) {
                        ClaimValue claimValue = new ClaimValue();
                        claimValue.setClaimURI(claimUri);
                        claimValue.setValue(modifiedFilter);
                        datas = client.listUserByClaimWithPermission(claimValue, userDomainSelector, PERMISSION_VIEWTASKS, -1);
                    } else {
                        datas = client.listAllUsersWithPermission(modifiedFilter, PERMISSION_VIEWTASKS, -1);
                    }
                    List<FlaggedName> dataList = new ArrayList<>(Arrays.asList(datas));
                    exceededDomains = dataList.remove(dataList.size() - 1);
                    session.setAttribute(UserAdminUIConstants.USER_LIST_CACHE_EXCEEDED, exceededDomains);
                    if (dataList.size() == 0) {
                        session.removeAttribute(UserAdminUIConstants.USER_LIST_FILTER);
                        showFilterMessage = true;
                    }
                    flaggedNameMap = new HashMap<>();
                    int max = pageNumber + cachePages;
                    for (int i = (pageNumber - cachePages); i < max; i++) {
                        if (i < 0) {
                            max++;
                            continue;
                        }
                        PaginatedNamesBean bean = Util.retrievePaginatedFlaggedName(i, dataList);
                        flaggedNameMap.put(i, bean);
                        if (bean.getNumberOfPages() == i + 1) {
                            break;
                        }
                    }
                    users = flaggedNameMap.get(pageNumber).getNames();
                    numberOfPages = flaggedNameMap.get(pageNumber).getNumberOfPages();
                    session.setAttribute(UserAdminUIConstants.USER_LIST_CACHE, flaggedNameMap);
                }
            } catch (Exception e) {
                String message = MessageFormat.format(resourceBundle.getString("error.while.user.filtered"), e.getMessage());
            }
            String resp = "";
            if (users != null) {
                UserBean[] userList = new UserBean[users.length];
                for (int i = 0; i < users.length; i++) {
                    FlaggedName flaggedName = users[i];
                    UserBean user = new UserBean();
                    user.setUsername(flaggedName.getItemName());
                    userList[i] = user;
                }
                UserSearchResult userSearchResult = new UserSearchResult();
                userSearchResult.setPageNumber(pageNumber);
                userSearchResult.setNumberOfPages(numberOfPages);
                userSearchResult.setNoOfPageLinksToDisplay(noOfPageLinksToDisplay);
                userSearchResult.setUserBeans(userList);
                Gson gson = new Gson();
                resp = gson.toJson(userSearchResult);
            }
            response.setContentType("application/json");
            response.getWriter().write(resp);
        }
    } else if (ROLES.equals(category)) {
        boolean error = false;
        boolean newFilter = false;
        boolean doRoleList = true;
        boolean showFilterMessage = false;
        boolean multipleUserStores = false;
        List<FlaggedName> datasList = null;
        FlaggedName[] roles = null;
        FlaggedName exceededDomains = null;
        String[] domainNames = null;
        int pageNumber = 0;
        int cachePages = 3;
        int noOfPageLinksToDisplay = 5;
        int numberOfPages = 0;
        Map<Integer, PaginatedNamesBean> flaggedNameMap = null;
        UserRealmInfo userRealmInfo = null;
        // clear session data
        session.removeAttribute("roleBean");
        session.removeAttribute(UserAdminUIConstants.ROLE_READ_ONLY);
        session.removeAttribute(UserAdminUIConstants.ROLE_LIST_UNASSIGNED_USER_CACHE);
        session.removeAttribute(UserAdminUIConstants.ROLE_LIST_UNASSIGNED_USER_CACHE_EXCEEDED);
        session.removeAttribute(UserAdminUIConstants.ROLE_LIST_ASSIGNED_USER_CACHE);
        session.removeAttribute(UserAdminUIConstants.ROLE_LIST_ASSIGNED_USER_CACHE_EXCEEDED);
        session.removeAttribute(UserAdminUIConstants.ROLE_LIST_ADD_ROLE_USER_CACHE);
        session.removeAttribute(UserAdminUIConstants.ROLE_LIST_ADD_ROLE_USER_CACHE_EXCEEDED);
        session.removeAttribute(UserAdminUIConstants.ROLE_LIST_ASSIGN_USER_FILTER);
        session.removeAttribute(UserAdminUIConstants.ROLE_LIST_UNASSIGNED_USER_FILTER);
        session.removeAttribute(UserAdminUIConstants.ROLE_LIST_VIEW_USER_FILTER);
        session.removeAttribute(UserAdminUIConstants.ROLE_LIST_CACHE);
        session.removeAttribute(PREVIOUS_ROLE);
        // search filter
        String selectedDomain = request.getParameter(DOMAIN);
        if (StringUtils.isBlank(selectedDomain)) {
            selectedDomain = (String) session.getAttribute(UserAdminUIConstants.ROLE_LIST_DOMAIN_FILTER);
            if (selectedDomain == null || selectedDomain.trim().length() == 0) {
                selectedDomain = UserAdminUIConstants.ALL_DOMAINS;
            }
        } else {
            newFilter = true;
        }
        session.setAttribute(UserAdminUIConstants.ROLE_LIST_DOMAIN_FILTER, selectedDomain.trim());
        String filter = request.getParameter(UserAdminUIConstants.ROLE_LIST_FILTER);
        if (filter == null || filter.trim().length() == 0) {
            filter = (String) session.getAttribute(UserAdminUIConstants.ROLE_LIST_FILTER);
            if (filter == null || filter.trim().length() == 0) {
                filter = "*";
            }
        } else {
            if (filter.contains(UserAdminUIConstants.DOMAIN_SEPARATOR)) {
                selectedDomain = UserAdminUIConstants.ALL_DOMAINS;
                session.removeAttribute(UserAdminUIConstants.ROLE_LIST_DOMAIN_FILTER);
            }
            newFilter = true;
        }
        String modifiedFilter = filter.trim();
        if (!UserAdminUIConstants.ALL_DOMAINS.equalsIgnoreCase(selectedDomain)) {
            modifiedFilter = selectedDomain + UserAdminUIConstants.DOMAIN_SEPARATOR + filter;
            modifiedFilter = modifiedFilter.trim();
        }
        session.setAttribute(UserAdminUIConstants.ROLE_LIST_FILTER, filter.trim());
        userRealmInfo = (UserRealmInfo) session.getAttribute(UserAdminUIConstants.USER_STORE_INFO);
        if (userRealmInfo != null) {
            multipleUserStores = userRealmInfo.getMultipleUserStore();
        }
        String errorAttribute = (String) session.getAttribute(UserAdminUIConstants.DO_ROLE_LIST);
        exceededDomains = (FlaggedName) session.getAttribute(UserAdminUIConstants.ROLE_LIST_CACHE_EXCEEDED);
        // check page number
        String pageNumberStr = request.getParameter("pageNumber");
        if (pageNumberStr == null) {
            pageNumberStr = "0";
        }
        try {
            pageNumber = Integer.parseInt(pageNumberStr);
        } catch (NumberFormatException ignored) {
        // page number format exception
        }
        flaggedNameMap = (Map<Integer, PaginatedNamesBean>) session.getAttribute(UserAdminUIConstants.ROLE_LIST_CACHE);
        if (flaggedNameMap != null) {
            PaginatedNamesBean bean = flaggedNameMap.get(pageNumber);
            if (bean != null) {
                roles = bean.getNames();
                if (roles != null && roles.length > 0) {
                    numberOfPages = bean.getNumberOfPages();
                    doRoleList = false;
                }
            }
        }
        if (errorAttribute != null) {
            error = true;
            session.removeAttribute(UserAdminUIConstants.DO_ROLE_LIST);
        }
        if ((doRoleList || newFilter) && !error) {
            try {
                String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
                String backendServerURL = CarbonUIUtil.getServerURL(getServletConfig().getServletContext(), session);
                ConfigurationContext configContext = (ConfigurationContext) getServletConfig().getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
                UserAdminClient client = new UserAdminClient(cookie, backendServerURL, configContext);
                boolean sharedRoleEnabled = client.isSharedRolesEnabled();
                session.setAttribute(UserAdminUIConstants.SHARED_ROLE_ENABLED, sharedRoleEnabled);
                if (filter.length() > 0) {
                    FlaggedName[] datas = client.getAllPermittedRoleNames(modifiedFilter, PERMISSION_VIEWTASKS, -1);
                    datasList = new ArrayList<FlaggedName>(Arrays.asList(datas));
                    exceededDomains = datasList.remove(datasList.size() - 1);
                    session.setAttribute(UserAdminUIConstants.ROLE_LIST_CACHE_EXCEEDED, exceededDomains);
                    datas = datasList.toArray(new FlaggedName[datasList.size()]);
                    if (datas == null || datas.length == 0) {
                        session.removeAttribute(UserAdminUIConstants.ROLE_LIST_FILTER);
                        showFilterMessage = true;
                    }
                }
                if (userRealmInfo == null) {
                    userRealmInfo = client.getUserRealmInfo();
                    session.setAttribute(UserAdminUIConstants.USER_STORE_INFO, userRealmInfo);
                }
                if (datasList != null) {
                    flaggedNameMap = new HashMap<Integer, PaginatedNamesBean>();
                    int max = pageNumber + cachePages;
                    for (int i = (pageNumber - cachePages); i < max; i++) {
                        if (i < 0) {
                            max++;
                            continue;
                        }
                        PaginatedNamesBean bean = Util.retrievePaginatedFlaggedName(i, datasList);
                        flaggedNameMap.put(i, bean);
                        if (bean.getNumberOfPages() == i + 1) {
                            break;
                        }
                    }
                    roles = flaggedNameMap.get(pageNumber).getNames();
                    numberOfPages = flaggedNameMap.get(pageNumber).getNumberOfPages();
                    session.setAttribute(UserAdminUIConstants.ROLE_LIST_CACHE, flaggedNameMap);
                }
            } catch (Exception e) {
            }
            String resp = "";
            if (roles != null) {
                RoleBean[] roleList = new RoleBean[roles.length];
                for (int i = 0; i < roles.length; i++) {
                    FlaggedName flaggedName = roles[i];
                    RoleBean role = new RoleBean();
                    role.setRoleName(flaggedName.getItemName());
                    roleList[i] = role;
                }
                RoleSearchResult roleSearchResult = new RoleSearchResult();
                roleSearchResult.setPageNumber(pageNumber);
                roleSearchResult.setNumberOfPages(numberOfPages);
                roleSearchResult.setNoOfPageLinksToDisplay(noOfPageLinksToDisplay);
                roleSearchResult.setRoleBeans(roleList);
                Gson gson = new Gson();
                resp = gson.toJson(roleSearchResult);
            }
            response.setContentType("application/json");
            response.getWriter().write(resp);
        }
    }
}
Also used : HashMap(java.util.HashMap) FlaggedName(org.wso2.carbon.user.mgt.stub.types.carbon.FlaggedName) ArrayList(java.util.ArrayList) RoleBean(org.wso2.carbon.user.mgt.ui.RoleBean) Gson(com.google.gson.Gson) UserBean(org.wso2.carbon.user.mgt.ui.UserBean) PaginatedNamesBean(org.wso2.carbon.user.mgt.ui.PaginatedNamesBean) RoleSearchResult(org.wso2.carbon.user.mgt.ui.bean.RoleSearchResult) UserRealmInfo(org.wso2.carbon.user.mgt.stub.types.carbon.UserRealmInfo) ArrayList(java.util.ArrayList) List(java.util.List) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) UserAdminClient(org.wso2.carbon.user.mgt.ui.UserAdminClient) HttpSession(javax.servlet.http.HttpSession) ServletException(javax.servlet.ServletException) IOException(java.io.IOException) ClaimValue(org.wso2.carbon.user.mgt.stub.types.carbon.ClaimValue) UserSearchResult(org.wso2.carbon.user.mgt.ui.bean.UserSearchResult) ResourceBundle(java.util.ResourceBundle) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with UserRealmInfo

use of org.wso2.carbon.user.mgt.common.UserRealmInfo in project carbon-identity-framework by wso2.

the class UserRealmProxy method getUserRealmInfo.

public UserRealmInfo getUserRealmInfo() throws UserAdminException {
    UserRealmInfo userRealmInfo = new UserRealmInfo();
    String userName = CarbonContext.getThreadLocalCarbonContext().getUsername();
    try {
        RealmConfiguration realmConfig = realm.getRealmConfiguration();
        if (realm.getAuthorizationManager().isUserAuthorized(userName, "/permission/admin/manage/identity", CarbonConstants.UI_PERMISSION_ACTION) || realm.getAuthorizationManager().isUserAuthorized(userName, "/permission/admin/manage/identity/usermgt/users", CarbonConstants.UI_PERMISSION_ACTION) || realm.getAuthorizationManager().isUserAuthorized(userName, "/permission/admin/manage/identity/usermgt/passwords", CarbonConstants.UI_PERMISSION_ACTION) || realm.getAuthorizationManager().isUserAuthorized(userName, "/permission/admin/manage/identity/usermgt/view", CarbonConstants.UI_PERMISSION_ACTION) || realm.getAuthorizationManager().isUserAuthorized(userName, "/permission/admin/manage/identity/rolemgt/view", CarbonConstants.UI_PERMISSION_ACTION)) {
            userRealmInfo.setAdminRole(realmConfig.getAdminRoleName());
            userRealmInfo.setAdminUser(realmConfig.getAdminUserName());
            userRealmInfo.setEveryOneRole(realmConfig.getEveryOneRoleName());
            ClaimMapping[] defaultClaims = realm.getClaimManager().getAllClaimMappings(UserCoreConstants.DEFAULT_CARBON_DIALECT);
            if (ArrayUtils.isNotEmpty(defaultClaims)) {
                Arrays.sort(defaultClaims, new ClaimMappingsComparator());
            }
            List<String> fullClaimList = new ArrayList<String>();
            List<String> requiredClaimsList = new ArrayList<String>();
            List<String> defaultClaimList = new ArrayList<String>();
            for (ClaimMapping claimMapping : defaultClaims) {
                Claim claim = claimMapping.getClaim();
                fullClaimList.add(claim.getClaimUri());
                if (claim.isRequired()) {
                    requiredClaimsList.add(claim.getClaimUri());
                }
                if (claim.isSupportedByDefault()) {
                    defaultClaimList.add(claim.getClaimUri());
                }
            }
            userRealmInfo.setUserClaims(fullClaimList.toArray(new String[fullClaimList.size()]));
            userRealmInfo.setRequiredUserClaims(requiredClaimsList.toArray(new String[requiredClaimsList.size()]));
            userRealmInfo.setDefaultUserClaims(defaultClaimList.toArray(new String[defaultClaimList.size()]));
        }
        List<UserStoreInfo> storeInfoList = new ArrayList<UserStoreInfo>();
        List<String> domainNames = new ArrayList<String>();
        RealmConfiguration secondaryConfig = realmConfig;
        UserStoreManager secondaryManager = realm.getUserStoreManager();
        while (true) {
            secondaryConfig = secondaryManager.getRealmConfiguration();
            UserStoreInfo userStoreInfo = getUserStoreInfo(secondaryConfig, secondaryManager);
            if (secondaryConfig.isPrimary()) {
                userRealmInfo.setPrimaryUserStoreInfo(userStoreInfo);
            }
            storeInfoList.add(userStoreInfo);
            userRealmInfo.setBulkImportSupported(secondaryManager.isBulkImportSupported());
            String domainName = secondaryConfig.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME);
            if (domainName != null && domainName.trim().length() > 0) {
                domainNames.add(domainName.toUpperCase());
            }
            secondaryManager = secondaryManager.getSecondaryUserStoreManager();
            if (secondaryManager == null) {
                break;
            }
        }
        if (storeInfoList.size() > 1) {
            userRealmInfo.setMultipleUserStore(true);
        }
        userRealmInfo.setUserStoresInfo(storeInfoList.toArray(new UserStoreInfo[storeInfoList.size()]));
        userRealmInfo.setDomainNames(domainNames.toArray(new String[domainNames.size()]));
        String itemsPerPageString = realmConfig.getRealmProperty("MaxItemsPerUserMgtUIPage");
        int itemsPerPage = 15;
        try {
            itemsPerPage = Integer.parseInt(itemsPerPageString);
        } catch (Exception e) {
            if (log.isDebugEnabled()) {
                log.debug("Error parsing number of items per page, using default value", e);
            }
        }
        userRealmInfo.setMaxItemsPerUIPage(itemsPerPage);
        String maxPageInCacheString = realmConfig.getRealmProperty("MaxUserMgtUIPagesInCache");
        int maxPagesInCache = 6;
        try {
            maxPagesInCache = Integer.parseInt(maxPageInCacheString);
        } catch (Exception e) {
            if (log.isDebugEnabled()) {
                log.debug("Error parsing number of maximum pages in cache, using default value", e);
            }
        }
        userRealmInfo.setMaxUIPagesInCache(maxPagesInCache);
        String enableUIPageCacheString = realmConfig.getRealmProperty("EnableUserMgtUIPageCache");
        boolean enableUIPageCache = true;
        if (FALSE.equals(enableUIPageCacheString)) {
            enableUIPageCache = false;
        }
        userRealmInfo.setEnableUIPageCache(enableUIPageCache);
    } catch (Exception e) {
        // previously logged so logging not needed
        throw new UserAdminException(e.getMessage(), e);
    }
    return userRealmInfo;
}
Also used : UserStoreInfo(org.wso2.carbon.user.mgt.common.UserStoreInfo) ArrayList(java.util.ArrayList) AbstractUserStoreManager(org.wso2.carbon.user.core.common.AbstractUserStoreManager) UserStoreManager(org.wso2.carbon.user.core.UserStoreManager) JDBCUserStoreManager(org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager) UserAdminException(org.wso2.carbon.user.mgt.common.UserAdminException) UserAdminException(org.wso2.carbon.user.mgt.common.UserAdminException) RegistryException(org.wso2.carbon.registry.api.RegistryException) UserStoreException(org.wso2.carbon.user.core.UserStoreException) RealmConfiguration(org.wso2.carbon.user.api.RealmConfiguration) ClaimMapping(org.wso2.carbon.user.api.ClaimMapping) UserRealmInfo(org.wso2.carbon.user.mgt.common.UserRealmInfo) Claim(org.wso2.carbon.user.api.Claim)

Example 3 with UserRealmInfo

use of org.wso2.carbon.user.mgt.common.UserRealmInfo in project product-is by wso2.

the class UserManagementServiceAbstractTest method testGetUserRealmInfo.

@SetEnvironment(executionEnvironments = { ExecutionEnvironment.STANDALONE })
@Test(groups = "wso2.is", description = "Check getting user realm info", dependsOnMethods = "testSetRoleUIPermission")
public void testGetUserRealmInfo() throws Exception {
    UserRealmInfo realmInfo = userMgtClient.getUserRealmInfo();
    Assert.assertNotNull(realmInfo);
}
Also used : UserRealmInfo(org.wso2.carbon.user.mgt.stub.types.carbon.UserRealmInfo) SetEnvironment(org.wso2.carbon.automation.engine.annotations.SetEnvironment) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Example 4 with UserRealmInfo

use of org.wso2.carbon.user.mgt.common.UserRealmInfo in project product-is by wso2.

the class UserMgtServiceAbstractTestCase method testGetUserRealmInfo.

public void testGetUserRealmInfo() throws Exception {
    loginManger.login(isServer.getSuperTenant().getTenantAdmin().getUserName(), isServer.getSuperTenant().getTenantAdmin().getPassword(), isServer.getInstance().getHosts().get("default"));
    UserRealmInfo realmInfo = userMgtClient.getUserRealmInfo();
    Assert.assertNotNull(realmInfo);
    loginManger.logOut();
}
Also used : UserRealmInfo(org.wso2.carbon.user.mgt.stub.types.carbon.UserRealmInfo)

Example 5 with UserRealmInfo

use of org.wso2.carbon.user.mgt.common.UserRealmInfo in project product-is by wso2.

the class UserMgtTestCase method testGetUserRealmInfo.

@Test(groups = "wso2.is", description = "Check getting user realm info")
public void testGetUserRealmInfo() throws Exception {
    UserRealmInfo realmInfo = userMgtClient.getUserRealmInfo();
    Assert.assertNotNull(realmInfo);
}
Also used : UserRealmInfo(org.wso2.carbon.user.mgt.stub.types.carbon.UserRealmInfo) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Aggregations

UserRealmInfo (org.wso2.carbon.user.mgt.stub.types.carbon.UserRealmInfo)4 Test (org.testng.annotations.Test)3 ArrayList (java.util.ArrayList)2 Claim (org.wso2.carbon.user.api.Claim)2 ClaimMapping (org.wso2.carbon.user.api.ClaimMapping)2 UserRealmInfo (org.wso2.carbon.user.mgt.common.UserRealmInfo)2 ISIntegrationTest (org.wso2.identity.integration.common.utils.ISIntegrationTest)2 Gson (com.google.gson.Gson)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 ResourceBundle (java.util.ResourceBundle)1 ServletException (javax.servlet.ServletException)1 HttpSession (javax.servlet.http.HttpSession)1 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1 BeforeTest (org.testng.annotations.BeforeTest)1 SetEnvironment (org.wso2.carbon.automation.engine.annotations.SetEnvironment)1 RegistryException (org.wso2.carbon.registry.api.RegistryException)1