use of io.gravitee.rest.api.idp.api.identity.User 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.User 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();
}
Aggregations