shiro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Les Hazlewood <lhazlew...@apache.org>
Subject Re: Plain password and encrypted password doesn't match
Date Sat, 25 Jan 2014 22:49:03 GMT
You can see from the test cases in DefaultPasswordServiceTest [1] that it
should work as expected.  Super simple example:

PasswordService service = new DefaultPasswordService();
String plaintext = "12345";
String encrypted = service.encryptPassword(plaintext);
assert service.passwordsMatch(plaintext, encrypted); //true

What version of Shiro are you using?

[1]
http://svn.apache.org/repos/asf/shiro/branches/1.x/core/src/test/groovy/org/apache/shiro/authc/credential/DefaultPasswordServiceTest.groovy

On Sat, Jan 25, 2014 at 9:55 AM, salihrkc <salih_1989@live.com> wrote:

>     public void doRegister() throws SQLException{
>         PasswordService dps = new DefaultPasswordService();
>         System.out.println("Test succesful");
>          con = ds.getConnection();
>          PreparedStatement ps = con.prepareStatement("insert into
> user(username, password, email, fullname) values (?, ?, ?, ?)");
>          String temp = dps.encryptPassword(password);
>          ps.setString(1, userName);
>          ps.setString(2, temp);
>          ps.setString(3, emailAddress);
>          ps.setString(4, "Salih ERİKCİ");
>          ps.executeUpdate();
>         //DatabaseOperations.initializeDB(this);
>          System.out.println("AAAA  "+dps.passwordsMatch(password, temp));
>
>     }
>
> this outputs AAAA false
>
> What is the problem?
>
>
>
> --
> View this message in context:
> http://shiro-user.582556.n2.nabble.com/Plain-password-and-encrypted-password-doesn-t-match-tp7579551.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>

Mime
View raw message