protected void insertPrincipalIdAsAttributeIfNeeded ( final Principal principal , final Map < String , List < Object > > attributesToRelease , final Service service , final RegisteredService registeredService ) { if ( StringUtils . isNotBlank ( getPrincipalIdAttribute ( ) ) ) { LOGGER . debug ( "Attempting to resolve the principal id for service [{}]" , registeredService . getServiceId ( ) ) ; val id = registeredService . getUsernameAttributeProvider ( ) . resolveUsername ( principal , service , registeredService ) ; LOGGER . debug ( "Releasing resolved principal id [{}] as attribute [{}]" , id , getPrincipalIdAttribute ( ) ) ; attributesToRelease . put ( getPrincipalIdAttribute ( ) , CollectionUtils . wrapList ( principal . getId ( ) ) ) ; } }
Release principal id as attribute if needed .