use of io.gravitee.management.idp.api.identity.IdentityLookup in project gravitee-management-rest-api by gravitee-io.
the class CompositeIdentityManager method lookup.
@Override
public Optional<User> lookup(final String reference) {
LOGGER.debug("Looking for a user: reference[{}]", reference);
try {
IdentityReference identityReference = referenceSerializer.deserialize(reference);
LOGGER.debug("Lookup identity information from reference: source[{}] id[{}]", identityReference.getSource(), identityReference.getReference());
for (final IdentityLookup identityLookup : identityLookups) {
if (identityLookup.canHandle(identityReference)) {
final User user = identityLookup.retrieve(identityReference);
if (user != null) {
return of(user);
}
}
}
} catch (final Exception ex) {
LOGGER.error("Unable to extract IDP: token[" + reference + "]", ex);
}
return empty();
}
use of io.gravitee.management.idp.api.identity.IdentityLookup 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