Package org.wso2.carbon.user.core

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


                    }
                }
                user = IdentityUtil.getPPIDDisplayValue(ppid);
                IdentityPersistenceManager manager = IdentityPersistenceManager
                        .getPersistanceManager();
                UserRealm realm = null;
                realm = IdentityTenantUtil.getRealm(null, null);
                Registry registry = null;
                registry = IdentityTenantUtil.getRegistry(null, null);
                addUser(user, uuid, userClaims, null, realm);
                PPIDValueDO ppidValueDO = new PPIDValueDO();
View Full Code Here


    public void addUserWithOpenID(OpenIDDTO openID) throws Exception {
    }

    public boolean isAddUserEnabled() throws Exception {
      
        UserRealm userRealm = IdentityTenantUtil.getRealm(null, null);
        if (userRealm != null) {
            UserStoreManager userStoreManager = userRealm.getUserStoreManager();
            if (userStoreManager != null) {
                return !userStoreManager.isReadOnly();
            }
        }
View Full Code Here

        boolean isAuthenticated = false;
        boolean isAuthorized = false;
        String tenantAwareUserName = TenantUtils.getTenantAwareUsername(user);
        try {

            UserRealm realm = AnonymousSessionUtil.getRealmByUserName(
                    SecurityServiceHolder.getRegistryService(),
                    SecurityServiceHolder.getRealmService(),user);
            isAuthorized = realm.getAuthorizationManager().isUserAuthorized(tenantAwareUserName,
                                                                            servicePath,
                                                                            UserCoreConstants.
                                                                                    INVOKE_SERVICE_PERMISSION);

            if (isAuthorized == true) {
                isAuthenticated = realm.getUserStoreManager().authenticate(tenantAwareUserName, password);
            }

            return isAuthenticated;
        } catch (Exception e) {
            log.error(e.getMessage(), e);
View Full Code Here

                    "The realm service is not available.";
            log.error(msg);
            throw new RegistryException(msg);
        }
        try {
            UserRealm realm = registryContext.getRealmService().getBootstrapRealm();
            return new RegistryRealm(realm);
        } catch (Exception e) {
            String msg = "Error in getting the user realm for main tenant.";
            log.error(msg);
            throw new RegistryException(msg, e);
View Full Code Here

     * @return the bootstrap realm.
     * @throws RegistryException if the operation failed.
     */
    public static UserRealm getBootstrapRealm(RealmService realmService) throws RegistryException {
        try {
            UserRealm realm = realmService.getBootstrapRealm();
            return new RegistryRealm(realm);
        } catch (Exception e) {
            String msg = "Error in getting the user realm for main tenant.";
            log.error(msg);
            throw new RegistryException(msg, e);
View Full Code Here

            throws RegistryException {

        boolean putAllowed = false;

        UserRegistry userRegistry = Utils.getSecureRegistry(request);
        UserRealm userRealm = userRegistry.getUserRealm();

        try {
            if (userRealm.getAuthorizationManager().isUserAuthorized(
                    userName, resourcePath, ActionConstants.PUT)) {
                putAllowed = true;
            }
        } catch (UserStoreException e) {
View Full Code Here

            throws RegistryException {

        boolean putAllowed = false;

        UserRegistry userRegistry = Utils.getSecureRegistry(request);
        UserRealm userRealm = userRegistry.getUserRealm();

        try {
            if (userRealm.getAuthorizationManager().isUserAuthorized(
                    userName, resourcePath, ActionConstants.DELETE)) {
                putAllowed = true;
            }
        } catch (UserStoreException e) {
View Full Code Here

            throws RegistryException {

        boolean putAllowed = false;

        UserRegistry userRegistry = Utils.getSecureRegistry(request);
        UserRealm userRealm = userRegistry.getUserRealm();

        try {
            if (userRealm.getAuthorizationManager().isUserAuthorized(
                    userName, resourcePath, AccessControlConstants.AUTHORIZE)) {
                putAllowed = true;
            }
        } catch (UserStoreException e) {
View Full Code Here

     *
     * @return whether the user is authorized or not.
     * @throws RegistryException if the operation failed.
     */
    public static boolean authorize(String resourcePath, String action) throws RegistryException {
        UserRealm userRealm = CurrentSession.getUserRealm();
        String userName = CurrentSession.getUser();
        try {
            if (!userRealm.getAuthorizationManager()
                    .isUserAuthorized(userName, resourcePath, action)) {
                return false;
            }
        } catch (UserStoreException e) {
            String msg = "Could not check authorization. \nCaused by " + e.getMessage();
View Full Code Here

     *
     * @throws RegistryException if the operation failed.
     */
    public static void clearAuthorizations(String resourcePath) throws RegistryException {

        UserRealm userRealm = CurrentSession.getUserRealm();

        try {
            userRealm.getAuthorizationManager().clearResourceAuthorizations(resourcePath);

        } catch (UserStoreException e) {

            String msg = "Could not clear authorizations. " + e.getMessage();
            log.error(msg, e);
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.