org.springframework.security.crypto.factory.PasswordEncoderFactories Java Examples
The following examples show how to use
org.springframework.security.crypto.factory.PasswordEncoderFactories.
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: SecurityConfig.java From spring-boot-demo with MIT License | 5 votes |
/** * 配置用户 * 使用内存中的用户,实际项目中,一般使用的是数据库保存用户,具体的实现类可以使用JdbcDaoImpl或者JdbcUserDetailsManager * * @return */ @Bean @Override protected UserDetailsService userDetailsService() { InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager(); manager.createUser(User.withUsername("admin").password(PasswordEncoderFactories.createDelegatingPasswordEncoder().encode("admin")).authorities("USER").build()); return manager; }
Example #2
Source File: InMemoryAuthWebSecurityConfigurer.java From tutorials with MIT License | 5 votes |
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder(); auth.inMemoryAuthentication() .passwordEncoder(encoder) .withUser("spring") .password(encoder.encode("secret")) .roles("USER"); }
Example #3
Source File: BasicConfiguration.java From tutorials with MIT License | 5 votes |
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder(); auth .inMemoryAuthentication() .withUser("user") .password(encoder.encode("password")) .roles("USER") .and() .withUser("admin") .password(encoder.encode("admin")) .roles("USER", "ADMIN"); }
Example #4
Source File: PasswordEncoderTests.java From jakduk-api with MIT License | 5 votes |
@Test public void 스프링시큐리티_암호_인코딩() { String password = passwordEncoder.encode("1111"); Assert.assertFalse(passwordEncoder.matches("1112", password)); Assert.assertTrue(passwordEncoder.matches("1111", password)); DelegatingPasswordEncoder newPasswordEncoder = (DelegatingPasswordEncoder) PasswordEncoderFactories.createDelegatingPasswordEncoder(); newPasswordEncoder.setDefaultPasswordEncoderForMatches(new StandardPasswordEncoder()); System.out.println(newPasswordEncoder.encode("1111")); Assert.assertTrue(newPasswordEncoder.matches("1111", password)); }
Example #5
Source File: WebSecurityConfigJWT.java From quartz-manager with Apache License 2.0 | 5 votes |
private void configureInMemoryAuthentication(AuthenticationManagerBuilder authenticationManagerBuilder) throws Exception { PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder(); if(inMemoryAccountProps.isEnabled() && inMemoryAccountProps.getUsers() != null && !inMemoryAccountProps.getUsers().isEmpty()) { InMemoryUserDetailsManagerConfigurer<AuthenticationManagerBuilder> inMemoryAuth = authenticationManagerBuilder.inMemoryAuthentication(); inMemoryAccountProps.getUsers() .forEach(u -> inMemoryAuth .withUser(u.getName()) .password(encoder.encode(u.getPassword())) .roles(u.getRoles().toArray(new String[0]))); } }
Example #6
Source File: SecurityConfig.java From zuul-auth-example with MIT License | 5 votes |
@Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder(); auth.inMemoryAuthentication() .withUser("admin").password(encoder.encode("admin")).roles("ADMIN", "USER").and() .withUser("shuaicj").password(encoder.encode("shuaicj")).roles("USER"); }
Example #7
Source File: SecurityConfig.java From spring-reactive-sample with GNU General Public License v3.0 | 5 votes |
@Bean public MapReactiveUserDetailsService userDetailsRepository() { PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder(); UserDetails user = User.withUsername("user") .passwordEncoder(encoder::encode) .password("password") .roles("USER") .build(); UserDetails admin = User.withUsername("admin") .passwordEncoder(encoder::encode) .password("password") .roles("USER", "ADMIN") .build(); return new MapReactiveUserDetailsService(user, admin); }
Example #8
Source File: AuthorizationServerConfig.java From spring-security-oauth2-boot with Apache License 2.0 | 5 votes |
@Override public void configure(ClientDetailsServiceConfigurer clients) throws Exception { PasswordEncoder passwordEncoder = PasswordEncoderFactories.createDelegatingPasswordEncoder(); // @formatter:off clients.inMemory().withClient("ifusespasswordgranttype").authorizedGrantTypes("password") .secret(passwordEncoder.encode("thenneedsauthenticationmanager")).scopes("any"); // @formatter:on }
Example #9
Source File: SecurityUserDetailsService.java From poseidon with Apache License 2.0 | 5 votes |
@Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { Member member = memberMapper.selectByUsername(username); if (member == null) { throw new UsernameNotFoundException("user not found"); } PasswordEncoder encoder = PasswordEncoderFactories .createDelegatingPasswordEncoder(); String password = encoder.encode(member.getPassword()); return User.withUsername(username).password(password).roles("").build(); }
Example #10
Source File: SecurityConfiguration.java From daming with Apache License 2.0 | 5 votes |
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { PasswordEncoder passwordEncoder = PasswordEncoderFactories.createDelegatingPasswordEncoder(); auth.inMemoryAuthentication() .withUser("admin") .password(passwordEncoder.encode("secret")) .roles("ADMIN"); }
Example #11
Source File: AuthorizationServerConfiguration.java From spring-boot-demo with MIT License | 5 votes |
/** * 配置客户端详情服务 * 客户端详细信息在这里进行初始化,你能够把客户端详情信息写死在这里或者是通过数据库来存储调取详情信息 * * @param clients * @throws Exception */ @Override public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.inMemory() .withClient("client1")//用于标识用户ID .authorizedGrantTypes("authorization_code", "refresh_token")//授权方式 .scopes("test")//授权范围 .secret(PasswordEncoderFactories.createDelegatingPasswordEncoder().encode("123456"));//客户端安全码,secret密码配置从 Spring Security 5.0开始必须以 {bcrypt}+加密后的密码 这种格式填写; }
Example #12
Source File: WebSecurityConfiguration.java From microservices-oauth with Apache License 2.0 | 4 votes |
@Bean public PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #13
Source File: WebSecurityConfig.java From spring-boot-demo with MIT License | 4 votes |
@Bean PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #14
Source File: SecurityConfig.java From spring-cloud-dataflow with Apache License 2.0 | 4 votes |
@Bean public PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #15
Source File: WebSecurityConfig.java From mall4j with GNU Affero General Public License v3.0 | 4 votes |
@Bean public PasswordEncoder passwordEncoder(){ return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #16
Source File: BasicAuthSecurityConfiguration.java From hawkbit-examples with Eclipse Public License 1.0 | 4 votes |
@Bean protected PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #17
Source File: SecurityConfig.java From streaming-file-server with MIT License | 4 votes |
@Bean PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #18
Source File: SecurityConfiguration.java From bdf3 with Apache License 2.0 | 4 votes |
@Bean public PasswordEncoder standardPasswordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #19
Source File: WebSecurityConfig.java From black-shop with Apache License 2.0 | 4 votes |
@Bean public PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #20
Source File: WebSecurityBeansConfig.java From jump-the-queue with Apache License 2.0 | 4 votes |
/** * This method provide a new instance of {@code DelegatingPasswordEncoder} * * @return the newly create {@code DelegatingPasswordEncoder} */ @Bean public PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #21
Source File: Beans.java From zhcet-web with Apache License 2.0 | 4 votes |
@Bean public PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #22
Source File: PostServiceApplication.java From spring-microservice-sample with GNU General Public License v3.0 | 4 votes |
@Bean public PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #23
Source File: AuthServiceApplication.java From spring-microservice-sample with GNU General Public License v3.0 | 4 votes |
@Bean public PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #24
Source File: UserServiceApplication.java From spring-microservice-sample with GNU General Public License v3.0 | 4 votes |
@Bean public PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #25
Source File: SecurityConfig.java From spring-reactive-sample with GNU General Public License v3.0 | 4 votes |
@Bean PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #26
Source File: CustomAuthenticationApplication.java From Spring with Apache License 2.0 | 4 votes |
@Bean PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #27
Source File: WebSecurityConfig.java From danyuan-application with Apache License 2.0 | 4 votes |
@Bean public PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #28
Source File: WebSecurityConfiguration.java From spring-cloud-demo with Apache License 2.0 | 4 votes |
@Bean PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #29
Source File: SecurityConfig.java From spring-cloud-skipper with Apache License 2.0 | 4 votes |
@Bean public PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }
Example #30
Source File: AuthenticationApplication.java From Spring with Apache License 2.0 | 4 votes |
@Bean PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); }