Java Code Examples for org.springframework.security.crypto.encrypt.Encryptors#noOpText()

The following examples show how to use org.springframework.security.crypto.encrypt.Encryptors#noOpText() . 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: EnvironmentDecryptApplicationInitializerTests.java    From spring-cloud-commons with Apache License 2.0 6 votes vote down vote up
@Test
public void testDecryptCompositePropertySource() {
	ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext();
	EnvironmentDecryptApplicationInitializer initializer = new EnvironmentDecryptApplicationInitializer(
			Encryptors.noOpText());

	MapPropertySource devProfile = new MapPropertySource("dev-profile",
			Collections.singletonMap("key", "{cipher}value1"));

	MapPropertySource defaultProfile = new MapPropertySource("default-profile",
			Collections.singletonMap("key", "{cipher}value2"));

	CompositePropertySource cps = mock(CompositePropertySource.class);
	when(cps.getPropertyNames()).thenReturn(devProfile.getPropertyNames());
	when(cps.getPropertySources())
			.thenReturn(Arrays.asList(devProfile, defaultProfile));
	ctx.getEnvironment().getPropertySources().addLast(cps);

	initializer.initialize(ctx);
	then(ctx.getEnvironment().getProperty("key")).isEqualTo("value1");
}
 
Example 2
Source File: EnvironmentDecryptApplicationInitializerTests.java    From spring-cloud-commons with Apache License 2.0 6 votes vote down vote up
@Test
public void testDecryptNonStandardParent() {
	ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext();
	EnvironmentDecryptApplicationInitializer initializer = new EnvironmentDecryptApplicationInitializer(
			Encryptors.noOpText());

	TestPropertyValues.of("key:{cipher}value").applyTo(ctx);

	ApplicationContext ctxParent = mock(ApplicationContext.class);
	when(ctxParent.getEnvironment()).thenReturn(mock(Environment.class));

	ctx.setParent(ctxParent);

	initializer.initialize(ctx);

	then(ctx.getEnvironment().getProperty("key")).isEqualTo("value");
}
 
Example 3
Source File: SocialConfig.java    From pre with GNU General Public License v3.0 5 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    PreJdbcUsersConnectionRepository repository = new PreJdbcUsersConnectionRepository(dataSource,
            connectionFactoryLocator, Encryptors.noOpText());
    repository.setTablePrefix("social_");
    return repository;
}
 
Example 4
Source File: SocialConfig.java    From JiwhizBlogWeb with Apache License 2.0 5 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    MongoUsersConnectionRepositoryImpl repository = new MongoUsersConnectionRepositoryImpl(
            userSocialConnectionRepository, (SocialAuthenticationServiceLocator)connectionFactoryLocator, Encryptors.noOpText());
    repository.setConnectionSignUp(autoConnectionSignUp());
    return repository;
}
 
Example 5
Source File: EncryptionAutoConfiguration.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@Bean
public TextEncryptor defaultTextEncryptor() {
	if (this.locator != null) {
		return new LocatorTextEncryptor(this.locator);
	}
	if (StringUtils.hasText(this.key.getKey())) {
		return new EncryptorFactory(this.key.getSalt()).create(this.key.getKey());
	}
	return Encryptors.noOpText();
}
 
Example 6
Source File: SocialConfig.java    From paascloud-master with Apache License 2.0 5 votes vote down vote up
/**
 * Gets users connection repository.
 *
 * @param connectionFactoryLocator the connection factory locator
 *
 * @return the users connection repository
 */
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
	JdbcUsersConnectionRepository repository = new JdbcUsersConnectionRepository(dataSource, connectionFactoryLocator, Encryptors.noOpText());
	repository.setTablePrefix("pc_uac_");
	if (connectionSignUp != null) {
		repository.setConnectionSignUp(connectionSignUp);
	}
	return repository;
}
 
Example 7
Source File: SocialAutoConfiguration.java    From cola with MIT License 5 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
	JpaUsersConnectRepository repository = new JpaUsersConnectRepository(userConnectionRepository,
			connectionFactoryLocator, Encryptors.noOpText());
	if (connectionSignUp != null) {
		repository.setConnectionSignUp(connectionSignUp);
	}
	return repository;
}
 
Example 8
Source File: DatabaseSocialConfigurer.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
/**
 *
 * @param connectionFactoryLocator
 * @return
 */
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    TextEncryptor textEncryptor = Encryptors.noOpText();
    return new JdbcUsersConnectionRepository(dataSource, connectionFactoryLocator, textEncryptor);
}
 
Example 9
Source File: DatabaseSocialConfigurer.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    TextEncryptor textEncryptor = Encryptors.noOpText();
    return new JdbcUsersConnectionRepository(dataSource, connectionFactoryLocator, textEncryptor);
}
 
Example 10
Source File: DatabaseSocialConfigurer.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    TextEncryptor textEncryptor = Encryptors.noOpText();
    return new JdbcUsersConnectionRepository(dataSource, connectionFactoryLocator, textEncryptor);
}
 
Example 11
Source File: DatabaseSocialConfigurer.java    From lemonaid with MIT License 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    TextEncryptor textEncryptor = Encryptors.noOpText();
    return new JdbcUsersConnectionRepository(dataSource, connectionFactoryLocator, textEncryptor);
}
 
Example 12
Source File: ClusterConfigFetcherTest.java    From haven-platform with Apache License 2.0 4 votes vote down vote up
@Bean
TextEncryptor textEncryptor() {
    return Encryptors.noOpText();
}
 
Example 13
Source File: CredentialsIntegrationTest.java    From syndesis with Apache License 2.0 4 votes vote down vote up
@Bean
public TextEncryptor getTextEncryptor() {
    return Encryptors.noOpText();
}
 
Example 14
Source File: FebsSocialConfig.java    From FEBS-Security with Apache License 2.0 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    JdbcUsersConnectionRepository jdbcUsersConnectionRepository = new JdbcUsersConnectionRepository(dataSource, connectionFactoryLocator, Encryptors.noOpText());
    jdbcUsersConnectionRepository.setTablePrefix("t_");
    return jdbcUsersConnectionRepository;
}
 
Example 15
Source File: SecurityConfig.java    From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 4 votes vote down vote up
@Bean
public TextEncryptor textEncryptor() {
	return Encryptors.noOpText();
}
 
Example 16
Source File: SingleTextEncryptorLocator.java    From spring-cloud-config with Apache License 2.0 4 votes vote down vote up
public SingleTextEncryptorLocator(TextEncryptor encryptor) {
	this.encryptor = encryptor == null ? Encryptors.noOpText() : encryptor;
}
 
Example 17
Source File: SocialConfig.java    From blog-social-login-with-spring-social with Apache License 2.0 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    JdbcUsersConnectionRepository repository = new JdbcUsersConnectionRepository(dataSource,connectionFactoryLocator, Encryptors.noOpText());
    repository.setConnectionSignUp(new AccountConnectionSignUpService(usersDao));
    return repository;
}
 
Example 18
Source File: SocialConfig.java    From lolibox with Apache License 2.0 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    return new JpaUsersConnectionRepository(jpaTemplate, connectionFactoryLocator, Encryptors.noOpText());
}
 
Example 19
Source File: SocialConfig.java    From AIDR with GNU Affero General Public License v3.0 4 votes vote down vote up
@Bean
public TextEncryptor textEncryptor() {
    return Encryptors.noOpText();
}