Search in sources :

Example 1 with NamedPersonImpl

use of org.apereo.services.persondir.support.NamedPersonImpl in project cas by apereo.

the class ShibbolethPersonAttributeDao method getPerson.

@Override
public IPersonAttributes getPerson(final String uid) {
    final AttributeResolutionContext attributeResolutionContext = new AttributeResolutionContext();
    attributeResolutionContext.setPrincipal(uid);
    try {
        this.attributeResolver.resolveAttributes(attributeResolutionContext);
        final Map<String, List<Object>> attributes = attributeResolutionContext.getResolvedIdPAttributes().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, p -> p.getValue().getValues().stream().map(IdPAttributeValue::getValue).collect(Collectors.toList())));
        return new NamedPersonImpl(uid, attributes);
    } catch (final ResolutionException e) {
        throw Throwables.propagate(e);
    }
}
Also used : IPersonAttributes(org.apereo.services.persondir.IPersonAttributes) ResolutionException(net.shibboleth.idp.attribute.resolver.ResolutionException) Throwables(com.google.common.base.Throwables) IdPAttributeValue(net.shibboleth.idp.attribute.IdPAttributeValue) BasePersonAttributeDao(org.apereo.services.persondir.support.BasePersonAttributeDao) Set(java.util.Set) Collectors(java.util.stream.Collectors) IPersonAttributeDao(org.apereo.services.persondir.IPersonAttributeDao) AttributeResolutionContext(net.shibboleth.idp.attribute.resolver.context.AttributeResolutionContext) List(java.util.List) NamedPersonImpl(org.apereo.services.persondir.support.NamedPersonImpl) Map(java.util.Map) AttributeResolver(net.shibboleth.idp.attribute.resolver.AttributeResolver) Collections(java.util.Collections) ResolutionException(net.shibboleth.idp.attribute.resolver.ResolutionException) NamedPersonImpl(org.apereo.services.persondir.support.NamedPersonImpl) AttributeResolutionContext(net.shibboleth.idp.attribute.resolver.context.AttributeResolutionContext) List(java.util.List) Map(java.util.Map)

Aggregations

Throwables (com.google.common.base.Throwables)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 IdPAttributeValue (net.shibboleth.idp.attribute.IdPAttributeValue)1 AttributeResolver (net.shibboleth.idp.attribute.resolver.AttributeResolver)1 ResolutionException (net.shibboleth.idp.attribute.resolver.ResolutionException)1 AttributeResolutionContext (net.shibboleth.idp.attribute.resolver.context.AttributeResolutionContext)1 IPersonAttributeDao (org.apereo.services.persondir.IPersonAttributeDao)1 IPersonAttributes (org.apereo.services.persondir.IPersonAttributes)1 BasePersonAttributeDao (org.apereo.services.persondir.support.BasePersonAttributeDao)1 NamedPersonImpl (org.apereo.services.persondir.support.NamedPersonImpl)1