public Principal buildSurrogatePrincipal ( final String surrogate , final Principal primaryPrincipal , final Credential credentials , final RegisteredService registeredService ) { val repositories = new HashSet < String > ( 0 ) ; if ( registeredService != null ) { repositories . addAll ( registeredService . getAttributeReleasePolicy ( ) . getPrincipalAttributesRepository ( ) . getAttributeRepositoryIds ( ) ) ; } val attributes = ( Map ) CoreAuthenticationUtils . retrieveAttributesFromAttributeRepository ( attributeRepository , surrogate , repositories ) ; val principal = principalFactory . createPrincipal ( surrogate , attributes ) ; return new SurrogatePrincipal ( primaryPrincipal , principal ) ; }
Build principal .