use of io.gravitee.rest.api.idp.api.authentication.AuthenticationProvider in project gravitee-management-rest-api by gravitee-io.
the class BasicSecurityConfigurerAdapter method configure.
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
LOGGER.info("--------------------------------------------------------------");
LOGGER.info("Management API BasicSecurity Config");
LOGGER.info("Loading authentication identity providers for Basic authentication");
List<io.gravitee.rest.api.security.authentication.AuthenticationProvider> providers = authenticationProviderManager.getIdentityProviders().stream().filter(authenticationProvider -> !authenticationProvider.external()).collect(Collectors.toList());
for (io.gravitee.rest.api.security.authentication.AuthenticationProvider provider : providers) {
LOGGER.info("Loading authentication provider of type {} at position {}", provider.type(), provider.index());
boolean found = false;
Collection<IdentityProvider> identityProviders = identityProviderManager.getAll();
for (IdentityProvider identityProvider : identityProviders) {
if (identityProvider.type().equalsIgnoreCase(provider.type())) {
AuthenticationProvider authenticationProviderPlugin = identityProviderManager.loadIdentityProvider(identityProvider.type(), provider.configuration());
if (authenticationProviderPlugin != null) {
Object authenticationProvider = authenticationProviderPlugin.configure();
if (authenticationProvider instanceof org.springframework.security.authentication.AuthenticationProvider) {
auth.authenticationProvider((org.springframework.security.authentication.AuthenticationProvider) authenticationProvider);
} else if (authenticationProvider instanceof SecurityConfigurer) {
auth.apply((SecurityConfigurer) authenticationProvider);
}
found = true;
break;
}
}
}
if (!found) {
LOGGER.error("No authentication provider found for type: {}", provider.type());
}
}
LOGGER.info("--------------------------------------------------------------");
}
use of io.gravitee.rest.api.idp.api.authentication.AuthenticationProvider in project gravitee-management-rest-api by gravitee-io.
the class IdentityProviderManagerImpl method loadIdentityProvider.
@Override
public AuthenticationProvider loadIdentityProvider(String identityProvider, Map<String, Object> properties) {
// By loading an identity provider we are mounting both authentication provider and identity lookup
AuthenticationProvider authenticationProvider = authenticationProvider(identityProvider, properties);
IdentityLookup identityLookup = identityLookup(identityProvider, properties);
compositeIdentityManager.addIdentityLookup(identityLookup);
return authenticationProvider;
}
Aggregations