Examples of ShaPasswordEncoder


Examples of org.acegisecurity.providers.encoding.ShaPasswordEncoder

            DaoAuthenticationProvider provider =
                    (DaoAuthenticationProvider) ctx.getBean("daoAuthenticationProvider");
            String algorithm = WebloggerConfig.getProperty("passwds.encryption.algorithm");
            PasswordEncoder encoder = null;
            if (algorithm.equalsIgnoreCase("SHA")) {
                encoder = new ShaPasswordEncoder();
            } else if (algorithm.equalsIgnoreCase("MD5")) {
                encoder = new Md5PasswordEncoder();
            } else {
                log.error("Encryption algorithm '" + algorithm +
                        "' not supported, disabling encryption.");
View Full Code Here

Examples of org.acegisecurity.providers.encoding.ShaPasswordEncoder

            DaoAuthenticationProvider provider =
                    (DaoAuthenticationProvider) ctx.getBean("daoAuthenticationProvider");
            String algorithm = RollerConfig.getProperty("passwds.encryption.algorithm");
            PasswordEncoder encoder = null;
            if (algorithm.equalsIgnoreCase("SHA")) {
                encoder = new ShaPasswordEncoder();
            } else if (algorithm.equalsIgnoreCase("MD5")) {
                encoder = new Md5PasswordEncoder();
            } else {
                mLogger.error("Encryption algorithm '" + algorithm +
                        "' not supported, disabling encryption.");
View Full Code Here

Examples of org.acegisecurity.providers.encoding.ShaPasswordEncoder

    {
      sb.append(randomChar());
    }
    String salt = sb.toString();
    String passwordHash = salt + ":"
        + new ShaPasswordEncoder(256).encodePassword(password, salt);
    System.out.println(passwordHash);
  }
View Full Code Here

Examples of org.acegisecurity.providers.encoding.ShaPasswordEncoder

            DaoAuthenticationProvider provider =
                    (DaoAuthenticationProvider) ctx.getBean("daoAuthenticationProvider");
            String algorithm = RollerConfig.getProperty("passwds.encryption.algorithm");
            PasswordEncoder encoder = null;
            if (algorithm.equalsIgnoreCase("SHA")) {
                encoder = new ShaPasswordEncoder();
            } else if (algorithm.equalsIgnoreCase("MD5")) {
                encoder = new Md5PasswordEncoder();
            } else {
                mLogger.error("Encryption algorithm '" + algorithm +
                        "' not supported, disabling encryption.");
View Full Code Here

Examples of org.acegisecurity.providers.encoding.ShaPasswordEncoder

        URL updateUrl = new URL(domainUrlBase + "user/" + SERVICE_VERSION + "/" + username);
        return userService.update(updateUrl, userEntry);
    }

    public boolean setPassword(String username, String passwd) throws AppsForYourDomainException, ServiceException, IOException {
        ShaPasswordEncoder pwe = new ShaPasswordEncoder();
        String passwordHashFunction = pwe.getAlgorithm();
        passwd = pwe.encodePassword(passwd, null);

        UserEntry entry = retrieveUser(username);
        Login login = entry.getLogin();

        login.setPassword(passwd);
View Full Code Here

Examples of org.acegisecurity.providers.encoding.ShaPasswordEncoder

            DaoAuthenticationProvider provider =
                    (DaoAuthenticationProvider) ctx.getBean("daoAuthenticationProvider");
            String algorithm = RollerConfig.getProperty("passwds.encryption.algorithm");
            PasswordEncoder encoder = null;
            if (algorithm.equalsIgnoreCase("SHA")) {
                encoder = new ShaPasswordEncoder();
            } else if (algorithm.equalsIgnoreCase("MD5")) {
                encoder = new Md5PasswordEncoder();
            } else {
                mLogger.error("Encryption algorithm '" + algorithm +
                        "' not supported, disabling encryption.");
View Full Code Here

Examples of org.springframework.security.authentication.encoding.ShaPasswordEncoder

public abstract class SecurityUtils {
  private static String SYSTEM_WIDE_SALT = "jb3h4v3";

  public static String encodePassword(String passwordCleartext) {
    ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
    return encoder.encodePassword(passwordCleartext, SYSTEM_WIDE_SALT);
  }
View Full Code Here

Examples of org.springframework.security.authentication.encoding.ShaPasswordEncoder

                "        <user-service>" +
                "            <user name='bob' password='notused' authorities='ROLE_A' />" +
                "        </user-service>" +
                "    </authentication-provider>");

        ShaPasswordEncoder encoder = (ShaPasswordEncoder) FieldUtils.getFieldValue(getProvider(), "passwordEncoder");
        assertEquals("SHA-256", encoder.getAlgorithm());
    }
View Full Code Here

Examples of org.springframework.security.authentication.encoding.ShaPasswordEncoder

        }
    }

    public void testGettersSetters() {
        DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
        provider.setPasswordEncoder(new ShaPasswordEncoder());
        assertEquals(ShaPasswordEncoder.class, provider.getPasswordEncoder().getClass());

        provider.setSaltSource(new SystemWideSaltSource());
        assertEquals(SystemWideSaltSource.class, provider.getSaltSource().getClass());
View Full Code Here

Examples of org.springframework.security.authentication.encoding.ShaPasswordEncoder

*/
public class ShaPasswordEncoderTests extends TestCase {
    //~ Methods ========================================================================================================

    public void testBasicFunctionality() {
        ShaPasswordEncoder pe = new ShaPasswordEncoder();
        String raw = "abc123";
        String badRaw = "abc321";
        String salt = "THIS_IS_A_SALT";
        String encoded = pe.encodePassword(raw, salt);
        assertTrue(pe.isPasswordValid(encoded, raw, salt));
        assertFalse(pe.isPasswordValid(encoded, badRaw, salt));
        assertEquals("b2f50ffcbd3407fe9415c062d55f54731f340d32", encoded);

    }
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.