use of org.cloudfoundry.identity.uaa.impl.config.IdentityZoneConfigurationBootstrap in project uaa by cloudfoundry.
the class IdentityZoneConfigurationBootstrapTests method configureProvisioning.
@BeforeEach
public void configureProvisioning(@Autowired JdbcTemplate jdbcTemplate) {
TestUtils.cleanAndSeedDb(jdbcTemplate);
provisioning = new JdbcIdentityZoneProvisioning(jdbcTemplate);
bootstrap = new IdentityZoneConfigurationBootstrap(provisioning);
GeneralMfaProviderValidator mfaProviderValidator = new GeneralMfaProviderValidator();
MfaProviderProvisioning mfaProvisoning = new JdbcMfaProviderProvisioning(jdbcTemplate, mfaProviderValidator);
MfaProvider<GoogleMfaProviderConfig> provider = new MfaProvider<>();
provider.setName("testProvider");
provider.setType(MfaProvider.MfaProviderType.GOOGLE_AUTHENTICATOR);
provider.setConfig(new GoogleMfaProviderConfig());
provider.setIdentityZoneId("uaa");
mfaProvisoning.create(provider, "uaa");
MfaConfigValidator mfaConfigValidator = new MfaConfigValidator(mfaProvisoning);
GeneralIdentityZoneConfigurationValidator configValidator = new GeneralIdentityZoneConfigurationValidator(mfaConfigValidator);
validator = new GeneralIdentityZoneValidator(configValidator);
bootstrap.setValidator(validator);
// For the SamlTestUtils keys we are using.
Security.addProvider(new BouncyCastleProvider());
}
use of org.cloudfoundry.identity.uaa.impl.config.IdentityZoneConfigurationBootstrap in project uaa by cloudfoundry.
the class BootstrapTests method xlegacyTestDeprecatedProperties.
@Test
void xlegacyTestDeprecatedProperties() {
context = getServletContext(null, "test/bootstrap/deprecated_properties_still_work.yml");
ScimGroupProvisioning scimGroupProvisioning = context.getBean("scimGroupProvisioning", ScimGroupProvisioning.class);
List<ScimGroup> scimGroups = scimGroupProvisioning.retrieveAll(IdentityZoneHolder.get().getId());
assertThat(scimGroups, PredicateMatcher.has(g -> g.getDisplayName().equals("pony") && "The magic of friendship".equals(g.getDescription())));
assertThat(scimGroups, PredicateMatcher.has(g -> g.getDisplayName().equals("cat") && "The cat".equals(g.getDescription())));
IdentityZoneConfigurationBootstrap zoneBootstrap = context.getBean(IdentityZoneConfigurationBootstrap.class);
assertEquals("https://deprecated.home_redirect.com", zoneBootstrap.getHomeRedirect());
IdentityZone defaultZone = context.getBean(IdentityZoneProvisioning.class).retrieve("uaa");
IdentityZoneConfiguration defaultConfig = defaultZone.getConfig();
assertTrue(defaultConfig.getSamlConfig().getKeys().containsKey(SamlConfig.LEGACY_KEY_ID), "Legacy SAML keys should be available");
assertEquals(SamlLoginServerKeyManagerTests.CERTIFICATE.trim(), defaultConfig.getSamlConfig().getCertificate().trim());
assertEquals(SamlLoginServerKeyManagerTests.KEY.trim(), defaultConfig.getSamlConfig().getPrivateKey().trim());
assertEquals(SamlLoginServerKeyManagerTests.PASSWORD.trim(), defaultConfig.getSamlConfig().getPrivateKeyPassword().trim());
}
Aggregations