protected Collection < GrantedAuthority > transformToSimpleAuthorities ( Set < String > strAuthorities , boolean appendRolePrefix ) { if ( null != strAuthorities ) { Collection < GrantedAuthority > authorities = new HashSet <> ( strAuthorities . size ( ) ) ; for ( String authority : strAuthorities ) { if ( ! StringUtils . isEmpty ( authority ) ) { String role = authority . trim ( ) . toUpperCase ( Locale . ENGLISH ) ; if ( appendRolePrefix ) { authorities . add ( new SimpleGrantedAuthority ( getRolePrefix ( ) + role ) ) ; } else { authorities . add ( new SimpleGrantedAuthority ( role ) ) ; } } } return authorities ; } return Collections . emptyList ( ) ; }
transforms all authorities to upper case and append the prefix if appendRolePrefix = true