protected LinkedHashMap < String , U > retrieveAll ( final boolean readFromSession ) { final LinkedHashMap < String , U > profiles = new LinkedHashMap <> ( ) ; this . context . getRequestAttribute ( Pac4jConstants . USER_PROFILES ) . ifPresent ( request -> { if ( request instanceof LinkedHashMap ) { profiles . putAll ( ( LinkedHashMap < String , U > ) request ) ; } if ( request instanceof CommonProfile ) { profiles . put ( retrieveClientName ( ( U ) request ) , ( U ) request ) ; } } ) ; if ( readFromSession ) { this . sessionStore . get ( this . context , Pac4jConstants . USER_PROFILES ) . ifPresent ( sessionAttribute -> { if ( sessionAttribute instanceof LinkedHashMap ) { profiles . putAll ( ( LinkedHashMap < String , U > ) sessionAttribute ) ; } if ( sessionAttribute instanceof CommonProfile ) { profiles . put ( retrieveClientName ( ( U ) sessionAttribute ) , ( U ) sessionAttribute ) ; } } ) ; } removeExpiredProfiles ( profiles ) ; return profiles ; }
Retrieve the map of profiles from the session or the request .