本文整理汇总了Java中org.springframework.security.crypto.password.NoOpPasswordEncoder.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java NoOpPasswordEncoder.getInstance方法的具体用法?Java NoOpPasswordEncoder.getInstance怎么用?Java NoOpPasswordEncoder.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.security.crypto.password.NoOpPasswordEncoder
的用法示例。
在下文中一共展示了NoOpPasswordEncoder.getInstance方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: passwordEncoder
import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入方法依赖的package包/类
@Bean
public PasswordEncoder passwordEncoder() {
String encodingAlgo = environment.getProperty(ENCODING_ALGORITHM_PROPERTY_NAME, BCRYPT_ALGORITHM);
if ( encodingAlgo == null || encodingAlgo.isEmpty() ) {
encodingAlgo = BCRYPT_ALGORITHM;
}
switch (encodingAlgo.toLowerCase()) {
case BCRYPT_ALGORITHM:
return new BCryptPasswordEncoder();
case NOOP_ALGORITHM:
return NoOpPasswordEncoder.getInstance();
default:
throw new IllegalArgumentException("Unsupported password encoding algorithm : " + encodingAlgo);
}
}
开发者ID:gravitee-io,项目名称:gravitee-management-rest-api,代码行数:17,代码来源:InMemoryAuthenticationProviderConfiguration.java
示例2: getPasswordEncoder
import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入方法依赖的package包/类
public static PasswordEncoder getPasswordEncoder(String algorithm) {
if (algorithm == null) {
algorithm = "";
}
switch (algorithm) {
case BCRYPT_ENCODER:
return new BCryptPasswordEncoder();
case NO_ENCODER:
return NoOpPasswordEncoder.getInstance();
case SHA_256_ENCODER:
return new StandardPasswordEncoder();
default: {
LOGGER.error("No password encoder for algorithm " + algorithm + " found. "
+ "Password encoding is switched off.");
return NoOpPasswordEncoder.getInstance();
}
}
}
示例3: passwordEncoder
import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入方法依赖的package包/类
@Bean
public static PasswordEncoder passwordEncoder() {
return NoOpPasswordEncoder.getInstance();
}
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:5,代码来源:OAuth2AutoConfigurationTests.java
示例4: afterPropertiesSet
import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入方法依赖的package包/类
public void afterPropertiesSet() {
if ("md5".equals(type)) {
this.passwordEncoder = new Md5PasswordEncoder(salt);
} else {
this.passwordEncoder = NoOpPasswordEncoder.getInstance();
}
logger.info("choose {}", passwordEncoder.getClass());
}
示例5: testInsert
import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入方法依赖的package包/类
@Test
public void testInsert() throws Exception {
PasswordEncoder encoder = NoOpPasswordEncoder.getInstance();
ClientDocument clientDocument = new ClientDocument()
.setAuthorities(Arrays.asList("USER"))
.setClientId("angularClient")
.setClientSecret(encoder.encode("secret123"))
.setGrantTypes(Arrays.asList("password", "refresh_token"))
.setScopes(Arrays.asList("user_actions"))
.setResourceIds(Arrays.asList("PIMP_RESOURCE"));
clientDetailsService.saveClientDetails(clientDocument);
}
示例6: passwordEncoder
import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入方法依赖的package包/类
@Bean
public PasswordEncoder passwordEncoder() {
String encoderConfig = environment.getProperty("security.passwordencoder", String.class, "");
if ("spring_bcrypt".equalsIgnoreCase(encoderConfig)) {
return new BCryptPasswordEncoder();
} else {
return NoOpPasswordEncoder.getInstance();
}
}
示例7: JdbcAccountRepositoryTest
import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入方法依赖的package包/类
public JdbcAccountRepositoryTest() {
EmbeddedDatabase db = new GreenhouseTestDatabaseBuilder().member().testData(getClass()).getDatabase();
transactional = new Transactional(db);
jdbcTemplate = new JdbcTemplate(db);
AccountMapper accountMapper = new AccountMapper(new StubFileStorage(), "http://localhost:8080/members/{profileKey}");
accountRepository = new JdbcAccountRepository(jdbcTemplate, NoOpPasswordEncoder.getInstance(), accountMapper);
}
示例8: newPasswordEncoder
import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入方法依赖的package包/类
/**
* New password encoder password encoder.
*
* @param properties the properties
* @return the password encoder
*/
public static PasswordEncoder newPasswordEncoder(final PasswordEncoderProperties properties) {
final String type = properties.getType();
if (StringUtils.isBlank(type)) {
LOGGER.debug("No password encoder type is defined, and so none shall be created");
return NoOpPasswordEncoder.getInstance();
}
if (type.contains(".")) {
try {
LOGGER.debug("Configuration indicates use of a custom password encoder [{}]", type);
final Class<PasswordEncoder> clazz = (Class<PasswordEncoder>) Class.forName(type);
return clazz.newInstance();
} catch (final Exception e) {
LOGGER.error("Falling back to a no-op password encoder as CAS has failed to create "
+ "an instance of the custom password encoder class " + type, e);
return NoOpPasswordEncoder.getInstance();
}
}
final PasswordEncoderProperties.PasswordEncoderTypes encoderType = PasswordEncoderProperties.PasswordEncoderTypes.valueOf(type);
switch (encoderType) {
case DEFAULT:
LOGGER.debug("Creating default password encoder with encoding alg [{}] and character encoding [{}]",
properties.getEncodingAlgorithm(), properties.getCharacterEncoding());
return new DefaultPasswordEncoder(properties.getEncodingAlgorithm(), properties.getCharacterEncoding());
case STANDARD:
LOGGER.debug("Creating standard password encoder with the secret defined in the configuration");
return new StandardPasswordEncoder(properties.getSecret());
case BCRYPT:
LOGGER.debug("Creating BCRYPT password encoder given the strength [{}] and secret in the configuration",
properties.getStrength());
if (StringUtils.isBlank(properties.getSecret())) {
LOGGER.debug("Creating BCRYPT encoder without secret");
return new BCryptPasswordEncoder(properties.getStrength());
}
LOGGER.debug("Creating BCRYPT encoder with secret");
return new BCryptPasswordEncoder(properties.getStrength(),
new SecureRandom(properties.getSecret().getBytes(StandardCharsets.UTF_8)));
case SCRYPT:
LOGGER.debug("Creating SCRYPT encoder");
return new SCryptPasswordEncoder();
case PBKDF2:
if (StringUtils.isBlank(properties.getSecret())) {
LOGGER.debug("Creating PBKDF2 encoder without secret");
return new Pbkdf2PasswordEncoder();
}
final int hashWidth = 256;
return new Pbkdf2PasswordEncoder(properties.getSecret(), properties.getStrength(), hashWidth);
case NONE:
default:
LOGGER.debug("No password encoder shall be created given the requested encoder type [{}]", type);
return NoOpPasswordEncoder.getInstance();
}
}
示例9: passwordEncoder
import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入方法依赖的package包/类
@Bean
public PasswordEncoder passwordEncoder() {
// 明文编码器。这是一个不做任何操作的密码编码器,是Spring提供给我们做明文测试的。
// A password encoder that does nothing. Useful for testing where working with plain text
return NoOpPasswordEncoder.getInstance();
}
示例10: passwordEncoder
import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入方法依赖的package包/类
@Bean
@Primary
public PasswordEncoder passwordEncoder() {
return NoOpPasswordEncoder.getInstance();
}
示例11: passwordEncoder
import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入方法依赖的package包/类
@Primary
@Bean
public PasswordEncoder passwordEncoder() {
return NoOpPasswordEncoder.getInstance();
}
示例12: passwordEncoder
import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入方法依赖的package包/类
@Bean
public PasswordEncoder passwordEncoder() {
return NoOpPasswordEncoder.getInstance();
}
开发者ID:gravitee-io,项目名称:graviteeio-access-management,代码行数:5,代码来源:InlineAuthenticationProviderConfiguration.java
示例13: passwordEncoder
import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入方法依赖的package包/类
@Bean
public PasswordEncoder passwordEncoder() {
return NoOpPasswordEncoder.getInstance();
}