Search in sources :

Example 1 with IdentityLookup

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();
}
Also used : IdentityLookup(io.gravitee.management.idp.api.identity.IdentityLookup) SearchableUser(io.gravitee.management.idp.api.identity.SearchableUser) User(io.gravitee.management.idp.api.identity.User) IdentityReference(io.gravitee.management.idp.api.identity.IdentityReference)

Example 2 with IdentityLookup

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;
}
Also used : IdentityLookup(io.gravitee.management.idp.api.identity.IdentityLookup) AuthenticationProvider(io.gravitee.management.idp.api.authentication.AuthenticationProvider)

Aggregations

IdentityLookup (io.gravitee.management.idp.api.identity.IdentityLookup)2 AuthenticationProvider (io.gravitee.management.idp.api.authentication.AuthenticationProvider)1 IdentityReference (io.gravitee.management.idp.api.identity.IdentityReference)1 SearchableUser (io.gravitee.management.idp.api.identity.SearchableUser)1 User (io.gravitee.management.idp.api.identity.User)1