Examples of CryptedSimpleCredentials


Examples of cgl.shindig.security.CryptedSimpleCredentials

        String plainTextPwd = user.getPassword();
        String cryptedPwd;
      //If the password is NOT encrypted, then encrypt it.
        if (!pwdCrypted) {
      try {
        cryptedPwd = new CryptedSimpleCredentials(new SimpleCredentials(user.getScreenname(), plainTextPwd.toCharArray())).getPassword();
      } catch (NoSuchAlgorithmException e) {
        e.printStackTrace();
        return false;
      } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
View Full Code Here

Examples of org.apache.jackrabbit.core.security.authentication.CryptedSimpleCredentials

        for (String pw : pwds.keySet()) {
            u.changePassword(pw);

            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+"}", "");
        noMatch.put("{"+SecurityConstants.DEFAULT_DIGEST+"}", "{"+SecurityConstants.DEFAULT_DIGEST+"}");
        noMatch.put("{"+SecurityConstants.DEFAULT_DIGEST+"}any", "any");
        noMatch.put("{"+SecurityConstants.DEFAULT_DIGEST+"}any", "{"+SecurityConstants.DEFAULT_DIGEST+"}any");
        noMatch.put(sha1Hash, sha1Hash);
        noMatch.put(md5Hash, md5Hash);

        for (String pw : noMatch.keySet()) {
            u.changePassword(pw);

            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

Examples of org.apache.jackrabbit.core.security.authentication.CryptedSimpleCredentials

     * @return
     * @throws RepositoryException
     */
    static String buildPasswordValue(String password) throws RepositoryException {
        try {
            return new CryptedSimpleCredentials("_", password).getPassword();
        } catch (NoSuchAlgorithmException e) {
            throw new RepositoryException(e);
        } catch (UnsupportedEncodingException e) {
            throw new RepositoryException(e);
        }
View Full Code Here

Examples of org.apache.jackrabbit.core.security.authentication.CryptedSimpleCredentials

     * @see User#getCredentials()
     */
    public Credentials getCredentials() throws RepositoryException {
        try {
            String password = getNode().getProperty(P_PASSWORD).getString();
            return new CryptedSimpleCredentials(getID(), password);
        } catch (NoSuchAlgorithmException e) {
            throw new RepositoryException(e);
        } catch (UnsupportedEncodingException e) {
            throw new RepositoryException(e);
        }
View Full Code Here

Examples of org.apache.jackrabbit.core.security.authentication.CryptedSimpleCredentials

     * @return
     * @throws RepositoryException
     */
    static String buildPasswordValue(String password) throws RepositoryException {
        try {
            CryptedSimpleCredentials creds = new CryptedSimpleCredentials("_", password);
            return creds.getPassword();
        } catch (NoSuchAlgorithmException e) {
            throw new RepositoryException(e);
        } catch (UnsupportedEncodingException e) {
            throw new RepositoryException(e);
        }
View Full Code Here

Examples of org.apache.jackrabbit.core.security.authentication.CryptedSimpleCredentials

     * @see User#getCredentials()
     */
    public Credentials getCredentials() throws RepositoryException {
        try {
            String password = getNode().getProperty(P_PASSWORD).getString();
            Credentials creds = new CryptedSimpleCredentials(getID(), password);
            return creds;
        } catch (NoSuchAlgorithmException e) {
            throw new RepositoryException(e);
        } catch (UnsupportedEncodingException e) {
            throw new RepositoryException(e);
View Full Code Here

Examples of org.apache.jackrabbit.core.security.authentication.CryptedSimpleCredentials

     * @return
     * @throws RepositoryException
     */
    static String buildPasswordValue(String password) throws RepositoryException {
        try {
            return new CryptedSimpleCredentials("_", password).getPassword();
        } catch (NoSuchAlgorithmException e) {
            throw new RepositoryException(e);
        } catch (UnsupportedEncodingException e) {
            throw new RepositoryException(e);
        }
View Full Code Here

Examples of org.apache.jackrabbit.core.security.authentication.CryptedSimpleCredentials

     * @see User#getCredentials()
     */
    public Credentials getCredentials() throws RepositoryException {
        try {
            String password = getNode().getProperty(P_PASSWORD).getString();
            return new CryptedSimpleCredentials(getID(), password);
        } catch (NoSuchAlgorithmException e) {
            throw new RepositoryException(e);
        } catch (UnsupportedEncodingException e) {
            throw new RepositoryException(e);
        }
View Full Code Here

Examples of org.apache.jackrabbit.core.security.authentication.CryptedSimpleCredentials

     * @return
     * @throws RepositoryException
     */
    static String buildPasswordValue(String password) throws RepositoryException {
        try {
            return new CryptedSimpleCredentials("_", password).getPassword();
        } catch (NoSuchAlgorithmException e) {
            throw new RepositoryException(e);
        } catch (UnsupportedEncodingException e) {
            throw new RepositoryException(e);
        }
View Full Code Here

Examples of org.apache.jackrabbit.core.security.authentication.CryptedSimpleCredentials

     * @see User#getCredentials()
     */
    public Credentials getCredentials() throws RepositoryException {
        try {
            String password = getNode().getProperty(P_PASSWORD).getString();
            return new CryptedSimpleCredentials(getID(), password);
        } catch (NoSuchAlgorithmException e) {
            throw new RepositoryException(e);
        } catch (UnsupportedEncodingException e) {
            throw new RepositoryException(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.