Examples of PlaintextPasswordEncoder


Examples of org.jasig.cas.authentication.handler.PlainTextPasswordEncoder

    private SimpleTestUsernamePasswordAuthenticationHandler authenticationHandler;

    protected void setUp() throws Exception {
        this.authenticationHandler = new SimpleTestUsernamePasswordAuthenticationHandler();
        this.authenticationHandler
            .setPasswordEncoder(new PlainTextPasswordEncoder());
    }
View Full Code Here

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

     * @return
     */
    public PasswordCompareConfigurer passwordCompare() {
        return new PasswordCompareConfigurer()
            .passwordAttribute("password")
            .passwordEncoder(new PlaintextPasswordEncoder());
    }
View Full Code Here

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

    private SaltSource saltSource;

    private UserDetailsService userDetailsService;

    public DaoAuthenticationProvider() {
        setPasswordEncoder(new PlaintextPasswordEncoder());
    }
View Full Code Here

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

            auth
                .ldapAuthentication()
                    .groupSearchBase("ou=groups")
                    .userSearchFilter("(uid={0})")
                    .passwordCompare()
                        .passwordEncoder(new PlaintextPasswordEncoder()) // ldap-authentication-provider/password-compare/password-encoder@ref
                        .passwordAttribute("userPassword"); // ldap-authentication-provider/password-compare@password-attribute
        }
View Full Code Here

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

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

    public void testBasicFunctionality() {
        PlaintextPasswordEncoder pe = new PlaintextPasswordEncoder();

        String raw = "abc123";
        String rawDiffCase = "AbC123";
        String badRaw = "abc321";
        String salt = "THIS_IS_A_SALT";

        String encoded = pe.encodePassword(raw, salt);
        assertEquals("abc123{THIS_IS_A_SALT}", encoded);
        assertTrue(pe.isPasswordValid(encoded, raw, salt));
        assertFalse(pe.isPasswordValid(encoded, badRaw, salt));

        // make sure default is not to ignore password case
        assertFalse(pe.isIgnorePasswordCase());
        encoded = pe.encodePassword(rawDiffCase, salt);
        assertFalse(pe.isPasswordValid(encoded, raw, salt));

        // now check for ignore password case
        pe = new PlaintextPasswordEncoder();
        pe.setIgnorePasswordCase(true);

        // should be able to validate even without encoding
        encoded = pe.encodePassword(rawDiffCase, salt);
        assertTrue(pe.isPasswordValid(encoded, raw, salt));
        assertFalse(pe.isPasswordValid(encoded, badRaw, salt));
    }
View Full Code Here

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

        assertTrue(pe.isPasswordValid(encoded, raw, salt));
        assertFalse(pe.isPasswordValid(encoded, badRaw, salt));
    }

    public void testMergeDemerge() {
        PlaintextPasswordEncoder pwd = new PlaintextPasswordEncoder();

        String merged = pwd.encodePassword("password", "foo");
        String[] demerged = pwd.obtainPasswordAndSalt(merged);
        assertEquals("password", demerged[0]);
        assertEquals("foo", demerged[1]);
    }
View Full Code Here

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

    //~ Methods ========================================================================================================

    @Before
    public void setUp() throws Exception {
        authenticator = new PasswordComparisonAuthenticator(getContextSource());
        authenticator.setPasswordEncoder(new PlaintextPasswordEncoder());
        authenticator.setUserDnPatterns(new String[] {"uid={0},ou=people"});
        bob = new UsernamePasswordAuthenticationToken("bob", "bobspassword");
        ben = new UsernamePasswordAuthenticationToken("ben", "benspassword");
    }
View Full Code Here

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

    }

    @Test
    public void testWithUserSearch() {
        authenticator = new PasswordComparisonAuthenticator(getContextSource());
        authenticator.setPasswordEncoder(new PlaintextPasswordEncoder());
        assertTrue("User DN matches shouldn't be available", authenticator.getUserDns("Bob").isEmpty());

        DirContextAdapter ctx = new DirContextAdapter(new DistinguishedName("uid=Bob,ou=people"));
        ctx.setAttributeValue("userPassword", "bobspassword");
View Full Code Here

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

      System.out.println(encoder.encodePassword(args[2], args[1]));
    } else if (args[0].equals("sha")) {
      PasswordEncoder encoder = new ShaPasswordEncoder();
      System.out.println(encoder.encodePassword(args[2], args[1]));
    } else if (args[0].equals("plaintext")) {
      PasswordEncoder encoder = new PlaintextPasswordEncoder();
      System.out.println(encoder.encodePassword(args[2], args[1]));
    } else {
      System.out.println("Algorithm must be md5, sha or plaintext");
    }
  }
View Full Code Here

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

    super.setUp();

    realm = new DefaultSecurityRealm();
    realm.setConfiguration(PebbleContext.getInstance().getConfiguration());

    passwordEncoder = new PlaintextPasswordEncoder();
    realm.setPasswordEncoder(passwordEncoder);
    saltSource = new ReflectionSaltSource();
    saltSource.setUserPropertyToUse("getUsername");
    realm.setSaltSource(saltSource);
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.