File tree Expand file tree Collapse file tree
src/main/java/eu/openanalytics/containerproxy/auth/impl/saml Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3939import java .util .stream .Collectors ;
4040
4141import static eu .openanalytics .containerproxy .auth .impl .saml .SAMLConfiguration .DEFAULT_NAME_ATTRIBUTE ;
42+ import static eu .openanalytics .containerproxy .auth .impl .saml .SAMLConfiguration .NAME_ATTRIBUTE_NAME_ID_VALUE ;
4243import static eu .openanalytics .containerproxy .auth .impl .saml .SAMLConfiguration .PROP_LOG_ATTRIBUTES ;
4344import static eu .openanalytics .containerproxy .auth .impl .saml .SAMLConfiguration .PROP_NAME_ATTRIBUTE ;
4445import static eu .openanalytics .containerproxy .auth .impl .saml .SAMLConfiguration .PROP_ROLES_ATTRIBUTE ;
@@ -75,7 +76,13 @@ public AbstractAuthenticationToken convert(@Nonnull OpenSaml4AuthenticationProvi
7576 logAttributes (principal );
7677 }
7778
78- Optional <String > nameValue = getSingleAttributeValue (principal , nameAttribute );
79+ Optional <String > nameValue ;
80+ if (nameAttribute .equalsIgnoreCase (NAME_ATTRIBUTE_NAME_ID_VALUE )) {
81+ nameValue = Optional .ofNullable (nameId );
82+ } else {
83+ nameValue = getSingleAttributeValue (principal , nameAttribute );
84+ }
85+
7986 if (nameValue .isEmpty ()) {
8087 throw new UsernameNotFoundException (String .format ("[SAML] User: \" %s\" => name attribute missing from SAML assertion" , nameId ));
8188 }
Original file line number Diff line number Diff line change 6161public class SAMLConfiguration {
6262
6363 public static final String DEFAULT_NAME_ATTRIBUTE = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" ;
64+ public static final String NAME_ATTRIBUTE_NAME_ID_VALUE = "https://shinyproxy.io/nameid" ;
6465
6566 public static final String PROP_LOG_ATTRIBUTES = "proxy.saml.log-attributes" ;
6667 public static final String PROP_FORCE_AUTHN = "proxy.saml.force-authn" ;
You can’t perform that action at this time.
0 commit comments