• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NoOpPasswordEncoder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



NoOpPasswordEncoder类属于org.springframework.security.crypto.password包,在下文中一共展示了NoOpPasswordEncoder类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
        }
    }
}
 
开发者ID:patka,项目名称:cognitor,代码行数:20,代码来源:PasswordEncoderFactory.java


示例3: configure

import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入依赖的package包/类
@Override
public void configure(AuthorizationServerSecurityConfigurer security)
		throws Exception {
	security.passwordEncoder(NoOpPasswordEncoder.getInstance());
	if (this.properties.getCheckTokenAccess() != null) {
		security.checkTokenAccess(this.properties.getCheckTokenAccess());
	}
	if (this.properties.getTokenKeyAccess() != null) {
		security.tokenKeyAccess(this.properties.getTokenKeyAccess());
	}
	if (this.properties.getRealm() != null) {
		security.realm(this.properties.getRealm());
	}
}
 
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:15,代码来源:OAuth2AuthorizationServerConfiguration.java


示例4: 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


示例5: 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());
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:10,代码来源:PasswordEncoderFactoryBean.java


示例6: createAuthentication

import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入依赖的package包/类
public static Authentication createAuthentication(final String username,
                                                  final String plaintextPassword,
                                                  final Long userId,
                                                  final SystemUser.Role role,
                                                  final boolean authenticated) {
    final SystemUser user = new SystemUser();
    user.setUsername(username);
    user.setId(userId);
    user.setRole(role);
    user.setPasswordAsPlaintext(plaintextPassword, NoOpPasswordEncoder.getInstance());

    final List<GrantedAuthority> grantedAuthorities = (role != null)
            ? AuthorityUtils.createAuthorityList(role.name())
            : new LinkedList<>();

    final UserInfo.UserInfoBuilder builder =
            new UserInfo.UserInfoBuilder(user);

    final UserInfo principal = builder.createUserInfo();

    final TestingAuthenticationToken authenticationToken =
            new TestingAuthenticationToken(principal, plaintextPassword, grantedAuthorities);

    authenticationToken.setAuthenticated(authenticated);

    return authenticationToken;
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:28,代码来源:TestAuthenticationTokenUtil.java


示例7: 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);
}
 
开发者ID:sys-devel-d,项目名称:pimp,代码行数:14,代码来源:InsertClientDocumentIT.java


示例8: 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();
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:10,代码来源:FlowableIdmEngineConfiguration.java


示例9: shouldReturnNoOpEncoderWhenNullGiven

import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入依赖的package包/类
@Test
public void shouldReturnNoOpEncoderWhenNullGiven() {
    PasswordEncoder encoder = PasswordEncoderFactory.getPasswordEncoder(null);

    verifyErrorWasLogged();
    assertTrue(encoder instanceof NoOpPasswordEncoder);
}
 
开发者ID:patka,项目名称:cognitor,代码行数:8,代码来源:PasswordEncoderFactoryTest.java


示例10: 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);
}
 
开发者ID:mqprichard,项目名称:spring-greenhouse-clickstart,代码行数:8,代码来源:JdbcAccountRepositoryTest.java


示例11: configureGlobal

import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入依赖的package包/类
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
	auth.inMemoryAuthentication()
			.passwordEncoder(NoOpPasswordEncoder.getInstance())
			.withUser("foo").password("bar").roles("USER");
}
 
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:7,代码来源:OAuth2AutoConfigurationTests.java


示例12: 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();
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:61,代码来源:Beans.java


示例13: 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();
}
 
开发者ID:itmuch,项目名称:spring-cloud-docker-microservice-book-code,代码行数:7,代码来源:WebSecurityConfig.java


示例14: passwordEncoder

import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入依赖的package包/类
@Bean
@Primary
public PasswordEncoder passwordEncoder() {
	return NoOpPasswordEncoder.getInstance();
}
 
开发者ID:Itema-as,项目名称:dawn-marketplace-server,代码行数:6,代码来源:TestConfiguration.java


示例15: passwordEncoder

import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入依赖的package包/类
@Primary
@Bean
public PasswordEncoder passwordEncoder() {
    return NoOpPasswordEncoder.getInstance();
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:6,代码来源:IntegrationTestApplicationContext.java


示例16: 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


示例17: passwordEncoder

import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入依赖的package包/类
@Bean
public PasswordEncoder passwordEncoder() {
	return NoOpPasswordEncoder.getInstance();
}
 
开发者ID:markoradinovic,项目名称:Vaadin4Spring-MVP-Sample-SpringSecurity,代码行数:5,代码来源:SecurityConfig.java


示例18: shouldReturnNoOpEncoderWhenNoHashGiven

import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入依赖的package包/类
@Test
public void shouldReturnNoOpEncoderWhenNoHashGiven() {
    PasswordEncoder encoder = PasswordEncoderFactory.getPasswordEncoder("no_hash");
    assertTrue(encoder instanceof NoOpPasswordEncoder);
}
 
开发者ID:patka,项目名称:cognitor,代码行数:6,代码来源:PasswordEncoderFactoryTest.java


示例19: shouldReturnNoOpEncoderWhenUnknownParameterGiven

import org.springframework.security.crypto.password.NoOpPasswordEncoder; //导入依赖的package包/类
@Test
public void shouldReturnNoOpEncoderWhenUnknownParameterGiven() {
    PasswordEncoder encoder = PasswordEncoderFactory.getPasswordEncoder("typo");
    assertTrue(encoder instanceof NoOpPasswordEncoder);
}
 
开发者ID:patka,项目名称:cognitor,代码行数:6,代码来源:PasswordEncoderFactoryTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Assertion类代码示例发布时间:2022-05-21
下一篇:
Java ValidationError类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap