use of org.apereo.cas.authentication.principal.DefaultPrincipalAttributesRepository in project cas by apereo.
the class DefaultPrincipalAttributesRepositoryMapper method toPrincipalRepository.
@Override
public PrincipalAttributesRepository toPrincipalRepository(final RegisteredServiceEditBean.ServiceData data) {
final RegisteredServiceAttributeReleasePolicyEditBean attrRelease = data.getAttrRelease();
final RegisteredServiceAttributeReleasePolicyEditBean.Types attrType = attrRelease.getAttrOption();
if (attrType == RegisteredServiceAttributeReleasePolicyEditBean.Types.CACHED) {
final CachingPrincipalAttributesRepository r = new CachingPrincipalAttributesRepository(attrRelease.getCachedTimeUnit().toUpperCase(), attrRelease.getCachedExpiration());
switch(attrRelease.getMergingStrategy()) {
case ADD:
r.setMergingStrategy(AbstractPrincipalAttributesRepository.MergingStrategy.ADD);
break;
case MULTIVALUED:
r.setMergingStrategy(AbstractPrincipalAttributesRepository.MergingStrategy.MULTIVALUED);
break;
case REPLACE:
r.setMergingStrategy(AbstractPrincipalAttributesRepository.MergingStrategy.REPLACE);
break;
default:
r.setMergingStrategy(AbstractPrincipalAttributesRepository.MergingStrategy.NONE);
break;
}
return r;
}
if (attrType == RegisteredServiceAttributeReleasePolicyEditBean.Types.DEFAULT) {
return new DefaultPrincipalAttributesRepository();
}
return null;
}
Aggregations