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


Java BCryptPasswordEncoder类代码示例

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


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

示例1: clientAuthenticationProvider

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //导入依赖的package包/类
@Bean(name = "clientAuthenticationProvider")
public AuthenticationProvider clientAuthenticationProvider() {
	DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
	provider.setPasswordEncoder(new BCryptPasswordEncoder());
	provider.setUserDetailsService(new ClientDetailsUserDetailsService(clientAuthenticationService));
	return provider;
}
 
开发者ID:PatternFM,项目名称:tokamak,代码行数:8,代码来源:AuthorizationServerConfiguration.java

示例2: passwordEncoder

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

示例3: Usuario

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //导入依赖的package包/类
public Usuario(String n, String e, String p) {
	name = n;
	email = e;
	puntos = PUNTOS_POR_DEFECTO;
	passwordHash = new BCryptPasswordEncoder().encode(p);
	roles = new ArrayList<>();
	roles.add("ROLE_USER");
}
 
开发者ID:arubioVK,项目名称:La-Apostada,代码行数:9,代码来源:Usuario.java

示例4: RestAuthenticationProvider

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //导入依赖的package包/类
@Autowired
public RestAuthenticationProvider(final UserService userService, final CustomerService customerService,
    final BCryptPasswordEncoder encoder) {
  this.userService = userService;
  this.customerService = customerService;
  this.encoder = encoder;
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:8,代码来源:RestAuthenticationProvider.java

示例5: User

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //导入依赖的package包/类
public User(String email, String username, String password, boolean enabled, String fullname) {
    this.email = email;
    this.username = username;
    this.password = new BCryptPasswordEncoder().encode(password);
    this.enabled = enabled;
    this.fullname = fullname;
}
 
开发者ID:atereshkov,项目名称:Diber-backend,代码行数:8,代码来源:User.java

示例6: gerarBCrypt

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //导入依赖的package包/类
/**
 * Gera um hash utilizando o BCrypt.
 * 
 * @param senha
 * @return String
 */
public static String gerarBCrypt(String senha) {
	if (senha == null) {
		return senha;
	}

	log.info("Gerando hash com o BCrypt.");
	BCryptPasswordEncoder bCryptEncoder = new BCryptPasswordEncoder();
	return bCryptEncoder.encode(senha);
}
 
开发者ID:m4rciosouza,项目名称:ponto-inteligente-api,代码行数:16,代码来源:PasswordUtils.java

示例7: passwordEncoder

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //导入依赖的package包/类
@Bean
public BCryptPasswordEncoder passwordEncoder() {
	BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
	return bCryptPasswordEncoder;
}
 
开发者ID:oojorgeoo89,项目名称:QuizZz,代码行数:6,代码来源:WebMvcConfig.java

示例8: test02_CheckCredentials

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //导入依赖的package包/类
@Test
public void test02_CheckCredentials() {
    LOGGER.info("Running: test02_CheckCredentials");
    YourEntity yourEntity = identityProviderEntityManager.findYourEntityByEmail(IntegrationTestSetupBean.USER_EMAIL);
    assertNotNull(yourEntity);

    BCryptPasswordEncoder encoder =
            new BCryptPasswordEncoder(YourMicroserviceSecurityConstants.BCRYPT_STRENGTH_SETTING);
    assertTrue(encoder.matches(IntegrationTestSetupBean.CLEAR_TEXT_CREDENTIALS, yourEntity.getCredentials()));
}
 
开发者ID:jaschenk,项目名称:Your-Microservice,代码行数:11,代码来源:IdPCredentialIT.java

示例9: User

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //导入依赖的package包/类
public User(String id, String userName, String password, String email, int enabled) {
    this.id = id;
    this.userName = userName;
    this.password = new BCryptPasswordEncoder().encode(password);
    this.email = email;
    this.enabled = enabled;
}
 
开发者ID:tadeucruz,项目名称:spring-oauth2-jwt,代码行数:8,代码来源:User.java

示例10: encode

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //导入依赖的package包/类
public static String encode(String password) {
    BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(4);
    String encodedPassword = encoder.encode(password);
    return encodedPassword;
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:6,代码来源:BCryptPasswordEncoderMain.java

示例11: passwordEncoder

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //导入依赖的package包/类
/**
 * BCryptPasswordEncoder password encoder
 * @return
 */
@Bean
public PasswordEncoder passwordEncoder(){
    return new BCryptPasswordEncoder(4);
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:9,代码来源:SecurityConfig.java

示例12: insertDefaultUserAdministrator

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //导入依赖的package包/类
@Scheduled(fixedRate = 3600000)
public void insertDefaultUserAdministrator() throws SQLException {

    BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();

    connection = dataSource.getConnection();

    preparedStatementSelectUser = connection.prepareStatement(selectTableUserSQL);
    preparedStatementSelectUser.setString(1, "admin");
    ResultSet resultSetUser = preparedStatementSelectUser.executeQuery();

    preparedStatementSelectUserRole = connection.prepareStatement(selectTableUserRoleSQL);
    preparedStatementSelectUserRole.setString(1, "admin");
    ResultSet resultSetUserRole = preparedStatementSelectUserRole.executeQuery();

    preparedStatementSelectOAuthClientDetails = connection.prepareStatement(selectTableOAuthClientDetailSQL);
    preparedStatementSelectOAuthClientDetails.setString(1, "clientid");
    ResultSet resultOAuthClientDetails = preparedStatementSelectOAuthClientDetails.executeQuery();

    if (!resultOAuthClientDetails.next()) {
        preparedStatementInsertOAuthClientDetails = connection.prepareStatement(insertTableOAuthClientDetailsSQL);
        preparedStatementInsertOAuthClientDetails.setString(1, "clientid");
        preparedStatementInsertOAuthClientDetails.setString(2, "customoauth2");
        preparedStatementInsertOAuthClientDetails.setString(3, "secret");
        preparedStatementInsertOAuthClientDetails.setString(4, "read,write");
        preparedStatementInsertOAuthClientDetails.setString(5, "password,client_credentials,refresh_token");
        preparedStatementInsertOAuthClientDetails.setString(6, " ");
        preparedStatementInsertOAuthClientDetails.setString(7, " ");
        preparedStatementInsertOAuthClientDetails.setInt(8, 3600);
        preparedStatementInsertOAuthClientDetails.setInt(9, 3600);
        preparedStatementInsertOAuthClientDetails.setString(10, "{\"additional_param\":\"hello OAuth2\"}");
        preparedStatementInsertOAuthClientDetails.setBoolean(11, Boolean.TRUE);
        preparedStatementInsertOAuthClientDetails.executeUpdate();

        preparedStatementInsertOAuthClientDetails.close();
    }

    if (!resultSetUser.next() && !resultSetUserRole.next()) {
        preparedStatementInsertUser = connection.prepareStatement(insertTableUserSQL);
        preparedStatementInsertUser.setString(1, "admin");
        preparedStatementInsertUser.setString(2, bCryptPasswordEncoder.encode("admin"));
        preparedStatementInsertUser.setBoolean(3, Boolean.TRUE);
        preparedStatementInsertUser.executeUpdate();

        preparedStatementInsertUserRole = connection.prepareStatement(insertTableUserRoleSQL);
        preparedStatementInsertUserRole.setString(1, UUID.randomUUID().toString());
        preparedStatementInsertUserRole.setString(2, "ROLE_ADMIN");
        preparedStatementInsertUserRole.setString(3, "admin");
        preparedStatementInsertUserRole.executeUpdate();

        preparedStatementInsertUser.close();
        preparedStatementInsertUserRole.close();
    }

    preparedStatementSelectUser.close();
    preparedStatementSelectUserRole.close();
    connection.close();

}
 
开发者ID:RizkiMufrizal,项目名称:Spring-OAuth2-Custom,代码行数:60,代码来源:ScheduledTaskConfiguration.java

示例13: passwordEncoder

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //导入依赖的package包/类
/**
 * BCryptPasswordEncoder password encoder
 * @return
 */
@Description("Standard PasswordEncoder")
@Bean
public PasswordEncoder passwordEncoder(){
    return new BCryptPasswordEncoder(4);
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:10,代码来源:SecurityConfig.java

示例14: encryptPassword

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //导入依赖的package包/类
/**
 * 加密密码
 */
private void encryptPassword(SysUserBaseInfo userEntity) {
	String password = userEntity.getPassword();
	password = new BCryptPasswordEncoder().encode(password);
	userEntity.setPassword(password);
}
 
开发者ID:514840279,项目名称:danyuan-application,代码行数:9,代码来源:SysUserBaseController.java

示例15: passwordEncoder

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //导入依赖的package包/类
@Bean
public BCryptPasswordEncoder passwordEncoder() {
	return new BCryptPasswordEncoder();

}
 
开发者ID:514840279,项目名称:danyuan-application,代码行数:6,代码来源:WebSecurityConfig.java


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