Package org.apache.jetspeed.security

Examples of org.apache.jetspeed.security.PasswordCredential


            Object credential)
    {
        if (credential == null) return;
        if (credential instanceof PasswordCredential)
        {
            PasswordCredential pw = (PasswordCredential) credential;
            newUser.setUserCredential(pw.getUserName(), pw.getPassword(),pw.getExpirationDate(),pw.isEnabled(), pw.isExpired(), pw.isUpdateRequired());
            return;
        } else if (isPublic)
            newUser.addPublicCredential(credential);
        else
            newUser.addPrivateCredential(credential);
View Full Code Here


                .println("Error!!! PasswordCredentialProvider not available");
        return ENCODING_STRING;
    }
    try
    {
      PasswordCredential credential = provider.create(JETSPEED,ENCODING_STRING);
      if ((credential != null) && (credential.getPassword() != null))
        return new String(credential.getPassword());
      else
          return ENCODING_STRING;
    }
    catch (Exception e)
    {
View Full Code Here

            Object credential)
    {
        if (credential == null) return;
        if (credential instanceof PasswordCredential)
        {
            PasswordCredential pw = (PasswordCredential) credential;
            newUser.setUserCredential(pw.getUserName(), pw.getPassword(),pw.getExpirationDate(),pw.isEnabled(), pw.isExpired(), pw.isUpdateRequired());
            return;
        } else if (isPublic)
            newUser.addPublicCredential(credential);
        else
            newUser.addPrivateCredential(credential);
View Full Code Here

                .println("Error!!! PasswordCredentialProvider not available");
        return ENCODING_STRING;
    }
    try
    {
      PasswordCredential credential = provider.create(JETSPEED,ENCODING_STRING);
      if ((credential != null) && (credential.getPassword() != null))
        return new String(credential.getPassword());
      else
          return ENCODING_STRING;
    }
    catch (Exception e)
    {
View Full Code Here

        return null;
    }

    protected String getPassword(User user)
    {
        PasswordCredential credential = null;

        Set credentials = user.getSubject().getPrivateCredentials();
        Iterator iter = credentials.iterator();
        while (iter.hasNext())
        {
            Object o = iter.next();
            if (o instanceof PasswordCredential)
            {
                credential = (PasswordCredential) o;
                char[] charar = credential.getPassword();

                return new String(charar);
            }
        }
        return null;
View Full Code Here

                if ( password != null && password.trim().length() > 0 )
                {
                    userManager.setPassword(userName, null, password);
                    passwordSet = true;
                }
                PasswordCredential credential = getCredential(actionRequest, userName);
                if ( credential != null )
                {
                    String updateRequiredStr = actionRequest.getParameter("user_cred_updreq");
                    if (updateRequiredStr != null)
                    {
                        boolean updateRequired = Boolean.valueOf(updateRequiredStr).booleanValue();
                        if (updateRequired != credential.isUpdateRequired())
                        {
                            userManager.setPasswordUpdateRequired(userName,updateRequired);
                        }
                    }
                    String enabledStr = actionRequest.getParameter("user_cred_enabled");
                    if (enabledStr != null)
                    {
                        boolean enabled = Boolean.valueOf(enabledStr).booleanValue();
                        if (enabled != credential.isEnabled())
                        {
                            userManager.setPasswordEnabled(userName,enabled);
                        }
                    }
                    String expiredFlagStr = actionRequest.getParameter("user_expired_flag");
View Full Code Here

        return new LinkedList();
    }
   
    private PasswordCredential getCredential(User user)
    {
        PasswordCredential credential = null;
       
        Set credentials = user.getSubject().getPrivateCredentials();
        Iterator iter = credentials.iterator();
        while (iter.hasNext())
        {
View Full Code Here

                PortletMessaging.publish(actionRequest, SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_REFRESH, "true");
                PortletMessaging.publish(actionRequest, SecurityResources.TOPIC_USERS, SecurityResources.MESSAGE_SELECTED, userName);
                               
                User user = userManager.getUser(userName);
               
                PasswordCredential credential = getCredential(user);
                if ( credential != null )
                {
                    String updateRequiredStr = actionRequest.getParameter("user_cred_updreq");
                    if (updateRequiredStr != null)
                    {
                        boolean updateRequired = Boolean.valueOf(updateRequiredStr).booleanValue();
                        if (updateRequired != credential.isUpdateRequired())
                        {
                            userManager.setPasswordUpdateRequired(userName,updateRequired);
                        }
                    }                   
                }
View Full Code Here

     * @see org.apache.jetspeed.security.spi.PasswordCredentialProvider#create(java.lang.String, java.lang.String)
     */
    public PasswordCredential create(String userName, String password) throws SecurityException
    {
        validator.validate(password);
        PasswordCredential pc;
        if ( encoder != null )
        {
            pc = new DefaultPasswordCredentialImpl(userName, encoder.encode(userName, password).toCharArray());
        }
        else
View Full Code Here

                                {
                                    request.setSessionAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_USER_DISABLED);
                                }
                                else
                                {
                                    PasswordCredential pwdCredential = SecurityHelper.getPasswordCredential(user.getSubject());
                                    if ( pwdCredential == null || !pwdCredential.isEnabled() )
                                    {
                                        request.setSessionAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_CREDENTIAL_DISABLED);
                                    }
                                    else if ( pwdCredential.isExpired() )
                                    {
                                        request.setSessionAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_CREDENTIAL_EXPIRED);
                                    }
                                    else if ( maxNumberOfAuthenticationFailures > 1 && pwdCredential.getAuthenticationFailures() == maxNumberOfAuthenticationFailures -)
                                    {
                                        request.setSessionAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_FINAL_LOGIN_ATTEMPT);
                                    }
                                    else
                                    {
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.security.PasswordCredential

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.