Java Code Examples for org.springframework.security.authentication.encoding.Md5PasswordEncoder

The following examples show how to use org.springframework.security.authentication.encoding.Md5PasswordEncoder. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: paascloud-master   Source File: MD5Test.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Md 5 system wide salt source.
 */
private static void md5_SystemWideSaltSource() {
	Md5PasswordEncoder md5 = new Md5PasswordEncoder();
	md5.setEncodeHashAsBase64(false);

	// 使用动态加密盐的只需要在注册用户的时候将第二个参数换成用户名即可     
	String pwd = md5.encodePassword("123456", "acegisalt");
	log.info("MD5 SystemWideSaltSource: " + pwd + " len=" + pwd.length());
}
 
Example 2
Source Project: Spring-5.0-Cookbook   Source File: AppSecurityModelG.java    License: MIT License 5 votes vote down vote up
@Bean
public Md5PasswordEncoder md5PasswordEncoder(){
 Md5PasswordEncoder md5 = new Md5PasswordEncoder();
 md5.setEncodeHashAsBase64(true);
 md5.setIterations(32);
 return md5;
}
 
Example 3
Source Project: Spring-5.0-Cookbook   Source File: AppSecurityModelE2.java    License: MIT License 5 votes vote down vote up
@Bean
public Md5PasswordEncoder md5PasswordEncoder(){
 Md5PasswordEncoder md5 = new Md5PasswordEncoder();
 md5.setEncodeHashAsBase64(true);
 md5.setIterations(32);
 return md5;
}
 
Example 4
Source Project: Spring-5.0-Cookbook   Source File: AppPasswordEncoder.java    License: MIT License 5 votes vote down vote up
public String md5Encoder(String password, String salt) {
    Md5PasswordEncoder md5PasswordEncoder = new Md5PasswordEncoder();
    md5PasswordEncoder.setEncodeHashAsBase64(true);
    md5PasswordEncoder.setIterations(32);
    String encoded = md5PasswordEncoder.encodePassword(password,salt);
    return encoded;     
}
 
Example 5
Source Project: Spring-5.0-Cookbook   Source File: AppSecurityModelJ.java    License: MIT License 5 votes vote down vote up
@Bean
public Md5PasswordEncoder md5PasswordEncoder(){
 Md5PasswordEncoder md5 = new Md5PasswordEncoder();
 md5.setEncodeHashAsBase64(true);
 md5.setIterations(32);
 return md5;
}
 
Example 6
Source Project: Spring-5.0-Cookbook   Source File: AppSecurityModelE.java    License: MIT License 5 votes vote down vote up
@Bean
public Md5PasswordEncoder md5PasswordEncoder(){
 Md5PasswordEncoder md5 = new Md5PasswordEncoder();
 md5.setEncodeHashAsBase64(true);
 md5.setIterations(32);
 return md5;
}
 
Example 7
Source Project: Spring-5.0-Cookbook   Source File: AppSecurityModelF.java    License: MIT License 5 votes vote down vote up
@Bean
public Md5PasswordEncoder md5PasswordEncoder(){
 Md5PasswordEncoder md5 = new Md5PasswordEncoder();
 md5.setEncodeHashAsBase64(true);
 md5.setIterations(32);
 return md5;
}
 
Example 8
Source Project: Spring-5.0-Cookbook   Source File: AppSecurityModelG.java    License: MIT License 5 votes vote down vote up
@Bean
public Md5PasswordEncoder md5PasswordEncoder(){
 Md5PasswordEncoder md5 = new Md5PasswordEncoder();
 md5.setEncodeHashAsBase64(true);
 md5.setIterations(32);
 return md5;
}
 
Example 9
Source Project: Spring-5.0-Cookbook   Source File: AppSecurityModelE2.java    License: MIT License 5 votes vote down vote up
@Bean
public Md5PasswordEncoder md5PasswordEncoder(){
 Md5PasswordEncoder md5 = new Md5PasswordEncoder();
 md5.setEncodeHashAsBase64(true);
 md5.setIterations(32);
 return md5;
}
 
Example 10
Source Project: Spring-5.0-Cookbook   Source File: AppPasswordEncoder.java    License: MIT License 5 votes vote down vote up
public String md5Encoder(String password, String salt) {
    Md5PasswordEncoder md5PasswordEncoder = new Md5PasswordEncoder();
    md5PasswordEncoder.setEncodeHashAsBase64(true);
    md5PasswordEncoder.setIterations(32);
    String encoded = md5PasswordEncoder.encodePassword(password,salt);
    return encoded;     
}
 
Example 11
Source Project: Spring-5.0-Cookbook   Source File: AppSecurityModelJ.java    License: MIT License 5 votes vote down vote up
@Bean
public Md5PasswordEncoder md5PasswordEncoder(){
 Md5PasswordEncoder md5 = new Md5PasswordEncoder();
 md5.setEncodeHashAsBase64(true);
 md5.setIterations(32);
 return md5;
}
 
Example 12
Source Project: Spring-5.0-Cookbook   Source File: AppSecurityModelE.java    License: MIT License 5 votes vote down vote up
@Bean
public Md5PasswordEncoder md5PasswordEncoder(){
 Md5PasswordEncoder md5 = new Md5PasswordEncoder();
 md5.setEncodeHashAsBase64(true);
 md5.setIterations(32);
 return md5;
}
 
Example 13
Source Project: Spring-5.0-Cookbook   Source File: AppSecurityModelF.java    License: MIT License 5 votes vote down vote up
@Bean
public Md5PasswordEncoder md5PasswordEncoder(){
 Md5PasswordEncoder md5 = new Md5PasswordEncoder();
 md5.setEncodeHashAsBase64(true);
 md5.setIterations(32);
 return md5;
}
 
Example 14
Source Project: sctalk   Source File: WebSecurityConfig.java    License: Apache License 2.0 5 votes vote down vote up
@Autowired
public WebSecurityConfig(UserDetailsService userDetailsService,
        JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter,
        EntryPointUnauthorizedHandler entryPointUnauthorizedHandler,
        RestAccessDeniedHandler restAccessDeniedHandler) {
    this.userDetailsService = userDetailsService;
    this.jwtAuthenticationTokenFilter = jwtAuthenticationTokenFilter;
    this.entryPointUnauthorizedHandler = entryPointUnauthorizedHandler;
    this.restAccessDeniedHandler = restAccessDeniedHandler;
    this.passwordEncoder = new Md5PasswordEncoder();
}
 
Example 15
Source Project: onboard   Source File: PasswordUtilsTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testOldPWMigrate() {
    PasswordEncoder encoder = new Md5PasswordEncoder();
    String oldPW = encoder.encodePassword(STRING, null).toUpperCase();
    String newPW = PasswordUtils.updateOldEncPass(oldPW, DATESTRING);
    assertTrue("Old PW should match", PasswordUtils.isPasswordValid(newPW, STRING, DATESTRING));
}
 
Example 16
Source Project: xmall   Source File: SecurityConfig.java    License: MIT License 4 votes vote down vote up
@Bean
public PasswordEncoder passwordEncoder() {
    return new Md5PasswordEncoder();
}
 
Example 17
Source Project: xmall   Source File: SecurityConfig.java    License: MIT License 4 votes vote down vote up
@Bean
public PasswordEncoder passwordEncoder() {
    return new Md5PasswordEncoder();
}
 
Example 18
Source Project: macrozheng-mall   Source File: SecurityConfig.java    License: MIT License 4 votes vote down vote up
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth.userDetailsService(userDetailsService()).passwordEncoder(new Md5PasswordEncoder());
}
 
Example 19
Source Project: macrozheng-mall   Source File: SecurityConfig.java    License: MIT License 4 votes vote down vote up
@Bean
public PasswordEncoder passwordEncoder() {
    return new Md5PasswordEncoder();
}
 
Example 20
Source Project: macrozheng-mall   Source File: SecurityConfig.java    License: MIT License 4 votes vote down vote up
@Bean
public PasswordEncoder passwordEncoder() {
    return new Md5PasswordEncoder();
}
 
Example 21
protected String getRandomCode(HttpServletRequest request) {
	return new Md5PasswordEncoder().encodePassword(request.getSession().getId(), salt);
}
 
Example 22
Source Project: nextreports-server   Source File: StorageUpdate0.java    License: Apache License 2.0 4 votes vote down vote up
private void createSystemNodes() throws RepositoryException {
	LOG.info("Creating system nodes");
	
       Node rootNode = getTemplate().getRootNode();

       Node nextServerNode = rootNode.addNode(StorageConstants.NEXT_SERVER_FOLDER_NAME);
       nextServerNode.addMixin("mix:referenceable");
       nextServerNode.setProperty("className", Folder.class.getName());
       nextServerNode.setProperty("version", "-1");

       Node reportsNode = nextServerNode.addNode(StorageConstants.REPORTS_FOLDER_NAME);
       reportsNode.addMixin("mix:referenceable");
       reportsNode.setProperty("className", Folder.class.getName());

       Node datasourcesNode = nextServerNode.addNode(StorageConstants.DATASOURCES_FOLDER_NAME);
       datasourcesNode.addMixin("mix:referenceable");
       datasourcesNode.setProperty("className", Folder.class.getName());

       Node schedulersNode = nextServerNode.addNode(StorageConstants.SCHEDULER_FOLDER_NAME);
       schedulersNode.addMixin("mix:referenceable");
       schedulersNode.setProperty("className", Folder.class.getName());

       Node securityNode = nextServerNode.addNode(StorageConstants.SECURITY_FOLDER_NAME);
       securityNode.addMixin("mix:referenceable");
       securityNode.setProperty("className", Folder.class.getName());

       Node usersNode = securityNode.addNode(StorageConstants.USERS_FOLDER_NAME);
       usersNode.addMixin("mix:referenceable");
       usersNode.setProperty("className", Folder.class.getName());

       Node groupsNode = securityNode.addNode(StorageConstants.GROUPS_FOLDER_NAME);
       groupsNode.addMixin("mix:referenceable");
       groupsNode.setProperty("className", Folder.class.getName());

       Node adminNode = usersNode.addNode(StorageConstants.ADMIN_USER_NAME);
       adminNode.addMixin("mix:referenceable");
       adminNode.setProperty("className", User.class.getName());
       adminNode.setProperty("admin", true);
       PasswordEncoder passwordEncoder = new Md5PasswordEncoder();
       adminNode.setProperty("password", passwordEncoder.encodePassword("1", null));
       
       getTemplate().save();
}