Examples of Realm


Examples of com.adito.realms.Realm

     * @throws Exception
     */
    @Test
    public void updatePolicyDescription() throws Exception {
        String newPolicyDescription = "NewDescription";
        Realm realm = getUserService().getRealm(1);
        Policy policy = createPolicy(realm);
        policy.setResourceDescription(newPolicyDescription);
        getPolicyService().updatePolicy(policy);
        Policy updatedPolicy = getPolicyService().getPolicy(policy.getResourceId());
        assertEquals("The new policy description should be " + newPolicyDescription, newPolicyDescription, updatedPolicy.getResourceDescription());
View Full Code Here

Examples of com.adito.realms.Realm

    /**
     * @throws Exception
     */
    @Test
    public void checkPolicyRetrieval() throws Exception {
        Realm realm = getUserService().getRealm(1);
        Policy policy = createPolicy(realm);
        Policy retrievedById = getPolicyService().getPolicy(policy.getResourceId());
        Policy retrievedByName = getPolicyService().getPolicyByName(policy.getResourceName(), realm.getResourceId());
        assertEquals("The policies should be the same.", retrievedById, retrievedByName);
        getPolicyService().deletePolicy(policy.getResourceId());
    }
View Full Code Here

Examples of com.adito.realms.Realm

    /**
     * @throws Exception
     */
    @Test
    public void attachDetachPolicyToUser() throws Exception {
        Realm realm = getUserService().getDefaultRealm();
        Policy policy = createPolicy(realm);
        int users = getUserService().getDefaultUserDatabase().listAllUsers(UserDatabase.WILDCARD_SEARCH, Integer.MAX_VALUE).length;
        User user = createAccount();
        assertEquals(
            getUserService().getDefaultUserDatabase().listAllUsers(UserDatabase.WILDCARD_SEARCH, Integer.MAX_VALUE).length,
View Full Code Here

Examples of com.adito.realms.Realm

    /**
     * @throws Exception
     */
    @Test
    public void attachDetachPolicyToRole() throws Exception {
        Realm realm = getUserService().getDefaultRealm();
        Policy policy = createPolicy(realm);
        User user = createAccount();
        Role role = createRole("Group1");
        user = updateAccountRoles(user, Collections.singleton(role));
        getPolicyService().grantPolicyToPrincipal(policy, role);
View Full Code Here

Examples of com.adito.realms.Realm

        return getResource(resource);
    }
   
    @Test
    public void checkResourceAccessRights() throws Exception {
        Realm realm = getDefaultRealm();
        Policy policy = createPolicy(realm);
        User user = createAccount();
        getPolicyService().grantPolicyToPrincipal(policy, user);
       
        AccessRights accessRights = createAssignAccessRights(getResourceType().getPermissionClass());
View Full Code Here

Examples of com.adito.realms.Realm

                    }
                  }
                  catch(UserNotFoundException unfe) {
                    // Continue anyway
                    String username = request.getParameter("username");
                    Realm realm = UserDatabaseManager.getInstance().getDefaultRealm();
                    logonStateMachine.setState(LogonStateAndCache.STATE_UNKNOWN_USERNAME_PROMPT_FOR_PASSWORD);
                      logonStateMachine.setSpoofedHighestPriorityScheme(username);
                      logonStateMachine.getHighestPriorityScheme().setAccountLock(LogonControllerFactory.getInstance().checkForAccountLock(username, realm.getResourceName()));
                  }
              }
            }
         
            ((LogonForm) form).setHasMoreAuthenticationSchemes(logonStateMachine.enabledSchemesGraeterThanOne());
View Full Code Here

Examples of com.adito.realms.Realm

        } else {
          Calendar now = Calendar.getInstance();
           
            Class clazz = udd.getUserDatabaseClass();
            UserDatabase udb = (UserDatabase) clazz.newInstance();
            Realm realm = new DefaultRealm(type, 1, DEFAULT_REALM_NAME, DEFAULT_REALM_DESCRIPTION, now, now);
            if(!udb.isOpen() && open)
              udb.open(CoreServlet.getServlet(), realm);
            return udb;
        }
    }
View Full Code Here

Examples of com.adito.realms.Realm

  public AccountLock checkForAccountLock(String username, String realmName) throws SecurityErrorException,
          AccountLockedException {
    // Get the user lockout policy
    int maxLogonAttemptsBeforeLock = 0;
    int lockDuration = 0;
    Realm realm;
    try {
      realm = UserDatabaseManager.getInstance().getRealm(realmName);
    } catch (Exception e1) {
      throw new SecurityErrorException(SecurityErrorException.INTERNAL_ERROR, e1, "Failed to determine the realm name " + realmName + ".");
    }

    try {
      maxLogonAttemptsBeforeLock = Property.getPropertyInt(new RealmKey("security.maxLogonAttemptsBeforeLock",
              realm.getResourceId()));
      lockDuration = Property.getPropertyInt(new RealmKey("security.lockDuration", realm.getResourceId()));
    } catch (Exception e) {
      throw new SecurityErrorException(SecurityErrorException.INTERNAL_ERROR, e, "Failed to determine password lockout policy.");
    }
    // Get the current lock (if any)
    AccountLock lock = "true".equals(SystemProperties.get("adito.recoveryMode", "false")) ? null
View Full Code Here

Examples of com.adito.realms.Realm

            // remove the menu tree.
            sessionInfo.getHttpSession().removeAttribute(Constants.MENU_TREE);
            String username = sessionInfo.getUser().getPrincipalName();
          // clean up any policy setups as they have changed now.
          PolicyDatabaseFactory.getInstance().cleanup();
          Realm realm = sessionInfo.getUser().getRealm();
          // update the sessions user, so any changes are known.
          sessionInfo.setUser(UserDatabaseManager.getInstance().getUserDatabase(realm).getAccount(username));
        } catch (Exception e) {
        }
      }
View Full Code Here

Examples of com.adito.realms.Realm

     * user that this originated this session
     *
     * @return realm
     */
    public int getRealmId() {
        Realm r = user == null ? null : user.getRealm();
        return r == null ? 0 : r.getResourceId();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.