Package com.adito.properties.impl.realms

Examples of com.adito.properties.impl.realms.RealmKey


        return buffer.toString();
    }

    private RealmKey getRealmKey(String key) {
        String propertyOrDefault = propertyNames.getProperty(key, key);
        return new RealmKey(propertyOrDefault, realm);
    }
View Full Code Here


   *     <li>Add defaults groups</li>
   * </ul>
   */
  private void init() {
    // set configuration
    setServiceName(Property.getProperty(new RealmKey("pam.serviceName",this.realm)));

    // Generate JAAS Configuration
    Map<String, String> params = new HashMap<String, String>();
    params.put("serviceName", serviceName);
    AppConfigurationEntry entry = new AppConfigurationEntry("net.sf.jpam.jaas.JpamLoginModule", AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, params);
View Full Code Here

     
      return defaultUserDatabase;
    }
   
    public void initialize(boolean isSetupMode) throws ServletException {
        String type = Property.getProperty(new RealmKey("security.userDatabase", 1));
        try {
            if(userDatabases.containsKey(type)) {
                createDefaultUserDatabase(type);
            } else if (isSetupMode) {
                createDefaultUserDatabase("builtIn");
View Full Code Here

      if (principal.getPrincipalName() == null) {
        log.error("NULL principal name in principal object passed to isAdministrator!");
        return false;
      }

      List administrators = Property.getPropertyList(new RealmKey("security.administrators", principal.getRealm()
              .getRealmID()));

      for (Iterator it = administrators.iterator(); it.hasNext();) {
        if (principal.getPrincipalName().equals((String) it.next()))
          return true;
View Full Code Here

      }
    }
  }

  private void checkForMultipleSessions(User user, InetAddress address, int sessionType) throws UserDatabaseException {
    int type = Property.getPropertyInt(new RealmKey("security.multipleSessions", user.getRealm().getResourceId()));
    List activeSessions;
    switch (type) {
      case 0:
        break; // No restrction
      case 1:
View Full Code Here

    } 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

    } 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", udb.getRealm()
              .getResourceId()));
      maxLocksBeforeDisable = Property.getPropertyInt(new RealmKey("security.maxLocksBeforeDisable", udb.getRealm()
              .getResourceId()));
      lockDuration = Property.getPropertyInt(new RealmKey("security.lockDuration", udb.getRealm().getResourceId()));
    } catch (Exception e) {
      throw new SecurityErrorException(SecurityErrorException.INTERNAL_ERROR, e, "Failed to determine password lockout policy.");
    }
    if (lock == null && maxLogonAttemptsBeforeLock > 0 && lockDuration > 0) {
      lock = createLock(username);
View Full Code Here

  private boolean checkRemoteAddress(String logonTicket, String remoteAddr) {

    try {
      SessionInfo session = getSessionInfo(logonTicket);
     
      if(Property.getPropertyBoolean(new RealmKey("security.checkRemoteAddress", session.getRealmId()))) {
        InetAddress addr = InetAddress.getByName(remoteAddr);
        if(log.isDebugEnabled())
          log.debug("Verifying " + addr.getHostAddress() + " is original address " + session.getAddress().getHostAddress());
        return session!=null && session.getAddress().equals(addr);
      } else
View Full Code Here

        if (udb.supportsPasswordChange()) {
            /* Check that the password matches the current policy, if not then
            request a new one */
            Pattern p = null;
            try {
                String pattern = Property.getProperty(new RealmKey("security.password.pattern", scheme.getUser().getRealm()
                                .getResourceId()));
                p = ReplacementEngine.getPatternPool().getPattern(pattern, false, false);
                if (!p.matcher(new String(credentials.getPassword())).matches()) {
                    scheme.getServletSession().setAttribute(Constants.PASSWORD_CHANGE_REASON_MESSAGE, new ActionMessage("passwordChange.noLongerMatchesPattern"));
                }
            } catch (Exception e) {
                throw new SecurityErrorException(SecurityErrorException.INTERNAL_ERROR, e, "Could not check password against current policy.");
            } finally {
                if (p != null) {
                    ReplacementEngine.getPatternPool().releasePattern(p);
                }
            }

            // Check if the password has expired (or is
            try {
                if (scheme.getUser().getLastPasswordChange() != null) {
                    GregorianCalendar lastChange = new GregorianCalendar();
                    lastChange.setTimeInMillis(scheme.getUser().getLastPasswordChange().getTime());

                    GregorianCalendar warningOn = new GregorianCalendar();

                    int warningInDays = Property.getPropertyInt(new RealmKey("security.password.daysBeforeExpiryWarning", scheme.getUser().getRealm()
                                    .getResourceId()));
                    warningOn.setTimeInMillis(scheme.getUser().getLastPasswordChange().getTime());
                    warningOn.add(Calendar.DATE, warningInDays);

                    GregorianCalendar expiresOn = new GregorianCalendar();
                    expiresOn.setTimeInMillis(scheme.getUser().getLastPasswordChange().getTime());

                    int expiryInDays = Property.getPropertyInt(new RealmKey("security.password.daysBeforeExpiry", scheme.getUser().getRealm()
                                    .getResourceId()));
                    expiresOn.add(Calendar.DATE, expiryInDays);

                    GregorianCalendar now = new GregorianCalendar();

View Full Code Here

    public AbstractPropertyKey createKey(PropertyDefinition definition, AbstractPropertiesForm form, SessionInfo sessionInfo) {
        if (definition.getPropertyClass().getName().equals(ContextConfig.NAME)) {
            return new ContextKey(definition.getName());
        } else if (definition.getPropertyClass().getName().equals(RealmProperties.NAME)) {
            return new RealmKey(definition.getName(), sessionInfo.getRealm());
        }
        return new SystemConfigKey(definition.getName());
    }
View Full Code Here

TOP

Related Classes of com.adito.properties.impl.realms.RealmKey

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.