Package org.apache.jackrabbit.core.security.authentication

Examples of org.apache.jackrabbit.core.security.authentication.CryptedSimpleCredentials.matches()


            String plain = pwds.get(pw);
            SimpleCredentials sc = new SimpleCredentials(u.getID(), plain.toCharArray());
            CryptedSimpleCredentials cc = (CryptedSimpleCredentials) u.getCredentials();

            assertTrue(cc.matches(sc));
        }

        // valid passwords, non-matching plain text
        Map<String, String>noMatch = new HashMap<String, String>();
        noMatch.put("{"+SecurityConstants.DEFAULT_DIGEST+"}", "");
View Full Code Here


            String plain = noMatch.get(pw);
            SimpleCredentials sc = new SimpleCredentials(u.getID(), plain.toCharArray());
            CryptedSimpleCredentials cc = (CryptedSimpleCredentials) u.getCredentials();

            assertFalse(cc.matches(sc));
        }

        // invalid pw string
        try {
            u.changePassword(null);
View Full Code Here

    public void changePassword(String password, String oldPassword) throws RepositoryException {
        // make sure the old password matches.
        try {
            CryptedSimpleCredentials csc = (CryptedSimpleCredentials) getCredentials();
            SimpleCredentials creds = new SimpleCredentials(getID(), oldPassword.toCharArray());
            if (!csc.matches(creds)) {
                throw new RepositoryException("Failed to change password: Old password does not match.");
            }
        } catch (NoSuchAlgorithmException e) {
            throw new RepositoryException("Cannot change password: failed to validate old password.");
        } catch (UnsupportedEncodingException e) {
View Full Code Here

            String plain = pwds.get(pw);
            SimpleCredentials sc = new SimpleCredentials(u.getID(), plain.toCharArray());
            CryptedSimpleCredentials cc = (CryptedSimpleCredentials) u.getCredentials();

            assertTrue(cc.matches(sc));
        }

        // valid passwords, non-matching plain text
        Map<String, String>noMatch = new HashMap<String, String>();
        noMatch.put("{"+SecurityConstants.DEFAULT_DIGEST+"}", "");
View Full Code Here

            String plain = noMatch.get(pw);
            SimpleCredentials sc = new SimpleCredentials(u.getID(), plain.toCharArray());
            CryptedSimpleCredentials cc = (CryptedSimpleCredentials) u.getCredentials();

            assertFalse(pw, cc.matches(sc));
        }
    }

    public void testChangePasswordNull() throws RepositoryException {
        User u = (User) userMgr.getAuthorizable(uID);
View Full Code Here

    public void changePassword(String password, String oldPassword) throws RepositoryException {
        // make sure the old password matches.
        try {
            CryptedSimpleCredentials csc = (CryptedSimpleCredentials) getCredentials();
            SimpleCredentials creds = new SimpleCredentials(getID(), oldPassword.toCharArray());
            if (!csc.matches(creds)) {
                throw new RepositoryException("Failed to change password: Old password does not match.");
            }
        } catch (NoSuchAlgorithmException e) {
            throw new RepositoryException("Cannot change password: failed to validate old password.");
        } catch (UnsupportedEncodingException e) {
View Full Code Here

            String plain = pwds.get(pw);
            SimpleCredentials sc = new SimpleCredentials(u.getID(), plain.toCharArray());
            CryptedSimpleCredentials cc = (CryptedSimpleCredentials) u.getCredentials();

            assertTrue(cc.matches(sc));
        }

        // valid passwords, non-matching plain text
        Map<String, String>noMatch = new HashMap<String, String>();
        noMatch.put("{"+SecurityConstants.DEFAULT_DIGEST+"}", "");
View Full Code Here

            String plain = noMatch.get(pw);
            SimpleCredentials sc = new SimpleCredentials(u.getID(), plain.toCharArray());
            CryptedSimpleCredentials cc = (CryptedSimpleCredentials) u.getCredentials();

            assertFalse(cc.matches(sc));
        }

        // invalid pw string
        try {
            u.changePassword(null);
View Full Code Here

        "DefaultPentahoPasswordEncoder.ERROR_0002_ENCPASS_CANNOT_BE_NULL" ) ); //$NON-NLS-1$
    Validate.notNull( rawPass, Messages.getInstance().getString(
        "DefaultPentahoPasswordEncoder.ERROR_0001_RAWPASS_CANNOT_BE_NULL" ) ); //$NON-NLS-1$
    try {
      CryptedSimpleCredentials credentials = new CryptedSimpleCredentials( "dummyUser", encPass );
      return credentials.matches( new SimpleCredentials( "dummyUser", rawPass.toCharArray() ) );
    } catch ( Exception e ) {
      throw new RuntimeException( e );
    }
  }
View Full Code Here

    public void changePassword(String password, String oldPassword) throws RepositoryException {
        // make sure the old password matches.
        try {
            CryptedSimpleCredentials csc = (CryptedSimpleCredentials) getCredentials();
            SimpleCredentials creds = new SimpleCredentials(getID(), oldPassword.toCharArray());
            if (!csc.matches(creds)) {
                throw new RepositoryException("Failed to change password: Old password does not match.");
            }
        } catch (NoSuchAlgorithmException e) {
            throw new RepositoryException("Cannot change password: failed to validate old password.");
        } catch (UnsupportedEncodingException e) {
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.