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

The following examples show how to use org.springframework.security.authentication.encoding.Md5PasswordEncoder. 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 File: AppSecurityModelJ.java    From Spring-5.0-Cookbook with 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 #2
Source File: AppSecurityModelF.java    From Spring-5.0-Cookbook with 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 File: AppSecurityModelE.java    From Spring-5.0-Cookbook with 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 File: AppSecurityModelJ.java    From Spring-5.0-Cookbook with 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 #5
Source File: AppPasswordEncoder.java    From Spring-5.0-Cookbook with 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 #6
Source File: AppSecurityModelE2.java    From Spring-5.0-Cookbook with 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 File: AppSecurityModelG.java    From Spring-5.0-Cookbook with 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 File: AppSecurityModelF.java    From Spring-5.0-Cookbook with 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 File: AppSecurityModelE.java    From Spring-5.0-Cookbook with 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 File: AppPasswordEncoder.java    From Spring-5.0-Cookbook with 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 File: AppSecurityModelE2.java    From Spring-5.0-Cookbook with 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 File: AppSecurityModelG.java    From Spring-5.0-Cookbook with 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 File: WebSecurityConfig.java    From sctalk with 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 #14
Source File: PasswordUtilsTest.java    From onboard with 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 #15
Source File: MD5Test.java    From paascloud-master with 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 #16
Source File: StorageUpdate0.java    From nextreports-server with 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();
}
 
Example #17
Source File: SavedRequestAwareAuthenticationSuccessHandler.java    From zxl with Apache License 2.0 4 votes vote down vote up
protected String getRandomCode(HttpServletRequest request) {
	return new Md5PasswordEncoder().encodePassword(request.getSession().getId(), salt);
}
 
Example #18
Source File: SecurityConfig.java    From xmall with MIT License 4 votes vote down vote up
@Bean
public PasswordEncoder passwordEncoder() {
    return new Md5PasswordEncoder();
}
 
Example #19
Source File: SecurityConfig.java    From macrozheng-mall with MIT License 4 votes vote down vote up
@Bean
public PasswordEncoder passwordEncoder() {
    return new Md5PasswordEncoder();
}
 
Example #20
Source File: SecurityConfig.java    From macrozheng-mall with MIT License 4 votes vote down vote up
@Bean
public PasswordEncoder passwordEncoder() {
    return new Md5PasswordEncoder();
}
 
Example #21
Source File: SecurityConfig.java    From macrozheng-mall with MIT License 4 votes vote down vote up
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth.userDetailsService(userDetailsService()).passwordEncoder(new Md5PasswordEncoder());
}
 
Example #22
Source File: SecurityConfig.java    From xmall with MIT License 4 votes vote down vote up
@Bean
public PasswordEncoder passwordEncoder() {
    return new Md5PasswordEncoder();
}