Skip to content

Instantly share code, notes, and snippets.

@pikanji
Last active December 11, 2015 08:29
Show Gist options
  • Save pikanji/4573740 to your computer and use it in GitHub Desktop.
Save pikanji/4573740 to your computer and use it in GitHub Desktop.
Sample code for blog post: http://kurotofu.sytes.net/kanji/fool/?p=914
<beans:bean id="encoder" class="org.springframework.security.crypto.password.StandardPasswordEncoder" />
<authentication-manager>
<authentication-provider>
<password-encoder ref="encoder" />
<user-service>
<user name="hoge" password="4c17b8a334f61a4d5c0b79f11977482ea7542c0761b74ee421b9cfe620ec1a7e07357932200428f6" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
public static void main(String[] args) {
System.out.println("Enter a string to encode:");
Scanner scan = new Scanner(System.in);
String org = scan.next();
System.out.println("Original String: "+ org);
StandardPasswordEncoder encoder = new StandardPasswordEncoder();
String enc = encoder.encode(org);
System.out.println("Encoded String: "+ enc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment