当前位置: 首页>>代码示例>>Java>>正文


Java PasswordEncoder类代码示例

本文整理汇总了Java中org.springframework.security.crypto.password.PasswordEncoder的典型用法代码示例。如果您正苦于以下问题:Java PasswordEncoder类的具体用法?Java PasswordEncoder怎么用?Java PasswordEncoder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PasswordEncoder类属于org.springframework.security.crypto.password包,在下文中一共展示了PasswordEncoder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DefaultCalendarService

import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Autowired
public DefaultCalendarService(final EventDao eventDao,
                              final CalendarUserDao userDao,
                              final CalendarUserRepository userRepository,
                              final PasswordEncoder passwordEncoder) {
    if (eventDao == null) {
        throw new IllegalArgumentException("eventDao cannot be null");
    }
    if (userDao == null) {
        throw new IllegalArgumentException("userDao cannot be null");
    }
    if (userRepository == null) {
        throw new IllegalArgumentException("userRepository cannot be null");
    }
    if (passwordEncoder == null) {
        throw new IllegalArgumentException("passwordEncoder cannot be null");
    }
    this.eventDao = eventDao;
    this.userDao = userDao;
    this.passwordEncoder = passwordEncoder;
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:22,代码来源:DefaultCalendarService.java

示例2: passwordEncoder

import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Bean(name="passwordEncoder")
@Autowired PasswordEncoder passwordEncoder(YadaConfiguration yadaConfiguration) {
	if (yadaConfiguration.encodePassword()) {
		return new BCryptPasswordEncoder();
	}
	return null;
}
 
开发者ID:xtianus,项目名称:yadaframework,代码行数:8,代码来源:YadaSecurityConfig.java

示例3: DefaultCalendarService

import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Autowired
public DefaultCalendarService(final EventDao eventDao,
                              final CalendarUserDao userDao,
                              final PasswordEncoder passwordEncoder) {
    if (eventDao == null) {
        throw new IllegalArgumentException("eventDao cannot be null");
    }
    if (userDao == null) {
        throw new IllegalArgumentException("userDao cannot be null");
    }
    if (passwordEncoder == null) {
        throw new IllegalArgumentException("passwordEncoder cannot be null");
    }
    this.eventDao = eventDao;
    this.userDao = userDao;
    this.passwordEncoder = passwordEncoder;
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:18,代码来源:DefaultCalendarService.java

示例4: change

import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Audit(action = "CHANGE_PASSWORD",
        actionResolverName = "CHANGE_PASSWORD_ACTION_RESOLVER",
        resourceResolverName = "CHANGE_PASSWORD_RESOURCE_RESOLVER")
@Override
public boolean change(final Credential credential, final PasswordChangeBean bean) {
    Assert.notNull(credential, "Credential cannot be null");
    Assert.notNull(bean, "PasswordChangeBean cannot be null");
    final UsernamePasswordCredential c = (UsernamePasswordCredential) credential;
    final PasswordEncoder encoder = Beans.newPasswordEncoder(passwordManagementProperties.getJdbc().getPasswordEncoder());
    final String password = encoder.encode(bean.getPassword());
    final int count = this.jdbcTemplate.update(passwordManagementProperties.getJdbc().getSqlChangePassword(), password, c.getId());
    return count > 0;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:14,代码来源:JdbcPasswordManagementService.java

示例5: DefaultCalendarService

import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Autowired
public DefaultCalendarService(final EventDao eventDao,
                              final CalendarUserDao userDao,
                              final JdbcOperations jdbcOperations,
                              final PasswordEncoder passwordEncoder) {
    if (eventDao == null) {
        throw new IllegalArgumentException("eventDao cannot be null");
    }
    if (userDao == null) {
        throw new IllegalArgumentException("userDao cannot be null");
    }
    if (jdbcOperations == null) {
        throw new IllegalArgumentException("jdbcOperations cannot be null");
    }
    if (passwordEncoder == null) {
        throw new IllegalArgumentException("passwordEncoder cannot be null");
    }
    this.eventDao = eventDao;
    this.userDao = userDao;
    this.jdbcOperations = jdbcOperations;
    this.passwordEncoder = passwordEncoder;
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:23,代码来源:DefaultCalendarService.java

示例6: calendarUserAuthenticationProvider

import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
/**
     * The PreAuthenticatedAuthenticationProvider does not process the {@link RolesAllowed} annotation.
     * @ param authenticationUserDetailsService
     * @return
     */
//    @Description("PreAuthenticatedAuthenticationProvider will return the existing Authentication token from the authenticate method")
//    @Bean
//    public PreAuthenticatedAuthenticationProvider preAuthAuthenticationProvider(final AuthenticationUserDetailsService authenticationUserDetailsService){
//        return new PreAuthenticatedAuthenticationProvider(){{
//            setPreAuthenticatedUserDetailsService(authenticationUserDetailsService);
//        }};
//    }

    @Description("AuthenticationMnager that will generate an authentication token unlike {@link PreAuthenticatedAuthenticationProvider}")
    @Bean @DependsOn({"defaultCalendarService"})
    public CalendarUserAuthenticationProvider calendarUserAuthenticationProvider(
            CalendarService calendarService,
            PasswordEncoder passwordEncoder){
        return new CalendarUserAuthenticationProvider(calendarService, passwordEncoder);
    }
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:21,代码来源:SecurityConfig.java

示例7: calendarUserAuthenticationProvider

import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Description("AuthenticationMnager that will generate an authentication token unlike {PreAuthenticatedAuthenticationProvider}")
@Bean @DependsOn({"defaultCalendarService"})
public CalendarUserAuthenticationProvider calendarUserAuthenticationProvider(
        CalendarService calendarService,
        PasswordEncoder passwordEncoder){
    return new CalendarUserAuthenticationProvider(calendarService, passwordEncoder);
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:8,代码来源:CustomAuthorizationConfig.java

示例8: calendarUserAuthenticationProvider

import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Description("AuthenticationMnager that will generate an authentication token unlike {@link PreAuthenticatedAuthenticationProvider}")
@Bean @DependsOn({"defaultCalendarService"})
public CalendarUserAuthenticationProvider calendarUserAuthenticationProvider(
        CalendarService calendarService,
        PasswordEncoder passwordEncoder){
    return new CalendarUserAuthenticationProvider(calendarService, passwordEncoder);
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:8,代码来源:SecurityConfig.java

示例9: CalendarUserAuthenticationProvider

import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Autowired
public CalendarUserAuthenticationProvider(final CalendarService calendarService,
                                          final PasswordEncoder passwordEncoder) {
    if (calendarService == null) {
        throw new IllegalArgumentException("calendarService cannot be null");
    }
    if (passwordEncoder == null) {
        throw new IllegalArgumentException("passwordEncoder cannot be null");
    }

    this.calendarService = calendarService;
    this.passwordEncoder = passwordEncoder;
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:14,代码来源:CalendarUserAuthenticationProvider.java

示例10: daoAuthenticationProvider

import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Bean
public DaoAuthenticationProvider daoAuthenticationProvider(UserDetailsService userDetailsService,
    PasswordEncoder passwordEncoder) {
    DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
    provider.setUserDetailsService(userDetailsService);
    provider.setPasswordEncoder(passwordEncoder);
    return provider;
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:9,代码来源:UaaConfiguration.java

示例11: calendarUserAuthenticationProvider

import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Description("AuthenticationManager that will generate an authentication token unlike {PreAuthenticatedAuthenticationProvider}")
@Bean @DependsOn({"defaultCalendarService"})
public CalendarUserAuthenticationProvider calendarUserAuthenticationProvider(
        CalendarService calendarService,
        PasswordEncoder passwordEncoder){
    return new CalendarUserAuthenticationProvider(calendarService, passwordEncoder);
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:8,代码来源:CustomAuthorizationConfig.java

示例12: KeysController

import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
KeysController(Environment env,
               MongoTemplate mongo,
               PasswordEncoder encoder) {

    this.env     = requireNonNull(env);
    this.mongo   = requireNonNull(mongo);
    this.encoder = requireNonNull(encoder);
}
 
开发者ID:membaza,项目名称:email-service,代码行数:9,代码来源:KeysController.java

示例13: verifyPasswordEncoderByMD5

import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Test
public void verifyPasswordEncoderByMD5() {
    final PasswordEncoderProperties p = new PasswordEncoderProperties();
    p.setType(PasswordEncoderProperties.PasswordEncoderTypes.DEFAULT.name());
    p.setEncodingAlgorithm("MD5");
    p.setCharacterEncoding("UTF-8");
    final PasswordEncoder e = Beans.newPasswordEncoder(p);
    assertTrue(e.matches("asd123", "bfd59291e825b5f2bbf1eb76569f8fe7"));
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:10,代码来源:DefaultPasswordEncoderTests.java

示例14: getterSetterPassword

import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Test
public void getterSetterPassword() {
    PasswordEncoder encoder = new BCryptPasswordEncoder();
    String password = "my_password";
    sut.setPassword(password);
    assertTrue(encoder.matches(password, sut.getPassword()));
}
 
开发者ID:2DV603NordVisaProject,项目名称:nordvisa_calendar,代码行数:8,代码来源:UserTest.java

示例15: name

import org.springframework.security.crypto.password.PasswordEncoder; //导入依赖的package包/类
@Test
public void name () throws Exception {
	PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();


	for ( int i = 0 ; i < 10 ; i++ ) {
		System.err.println( passwordEncoder.encode( "123456" ) );
	}
}
 
开发者ID:yujunhao8831,项目名称:spring-boot-start-current,代码行数:10,代码来源:PasswordEncoderTest.java


注:本文中的org.springframework.security.crypto.password.PasswordEncoder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。