@@ -296,21 +296,22 @@ public SAMLAuthenticationProvider samlAuthenticationProvider() {
296296 samlAuthenticationProvider .setUserDetails (new SAMLUserDetailsService () {
297297 @ Override
298298 public Object loadUserBySAML (SAMLCredential credential ) throws UsernameNotFoundException {
299- String nameAttribute = environment .getProperty ("proxy.saml.name-attribute" , DEFAULT_NAME_ATTRIBUTE );
300- String nameValue = credential .getAttributeAsString (nameAttribute );
301- if (nameValue == null ) throw new UsernameNotFoundException ("Name attribute missing from SAML assertion: " + nameAttribute );
302-
303299 List <Attribute > attributes = credential .getAttributes ();
304300
301+ String userID = credential .getNameID ().getValue ();
305302 attributes .forEach ((attribute ) -> {
306303 log .info (String .format ("[SAML] User: %s => found Attribute with name : %s (%s) and value %s - %s" ,
307- nameValue ,
304+ userID ,
308305 attribute .getName (),
309306 attribute .getFriendlyName (),
310- credential .getAttributeAsString (attribute .getName ()),
307+ credential .getAttributeAsString (attribute .getName ()),
311308 String .join (", " , credential .getAttributeAsStringArray (attribute .getName ()))));
312309 });
313310
311+ String nameAttribute = environment .getProperty ("proxy.saml.name-attribute" , DEFAULT_NAME_ATTRIBUTE );
312+ String nameValue = credential .getAttributeAsString (nameAttribute );
313+ if (nameValue == null ) throw new UsernameNotFoundException ("Name attribute missing from SAML assertion: " + nameAttribute );
314+
314315 List <GrantedAuthority > auth = new ArrayList <>();
315316 String rolesAttribute = environment .getProperty ("proxy.saml.roles-attribute" );
316317 if (rolesAttribute != null && !rolesAttribute .trim ().isEmpty ()) {
0 commit comments