use of io.gravitee.rest.api.idp.api.identity.IdentityLookup in project gravitee-management-rest-api by gravitee-io.
the class CompositeIdentityManager method search.
@Override
public Collection<SearchableUser> search(String query) {
Set<SearchableUser> users = new HashSet<>();
for (IdentityLookup identityLookup : identityLookups) {
if (identityLookup.searchable()) {
Collection<User> lookupUsers = identityLookup.search(query);
if (lookupUsers != null) {
boolean allowEmailInSearchResults = identityLookup.allowEmailInSearchResults();
users.addAll(lookupUsers.stream().map(user -> new DefaultSearchableUser(user, allowEmailInSearchResults)).collect(Collectors.toSet()));
}
}
}
return users;
}
use of io.gravitee.rest.api.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.rest.api.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