@@ -105,7 +105,6 @@ public static Document createLoginRequest(String id, String destination, String
105
105
String samlp = "urn:oasis:names:tc:SAML:2.0:protocol" ;
106
106
String saml = "urn:oasis:names:tc:SAML:2.0:assertion" ;
107
107
108
- PolicyFormat pf = PolicyFormat .getPolicyFormat (policyFormat );
109
108
110
109
DocumentBuilder builder = createDocumentBuilder ();
111
110
@@ -126,8 +125,7 @@ public static Document createLoginRequest(String id, String destination, String
126
125
request .appendChild (issuerElem );
127
126
128
127
org .w3c .dom .Element policy = doc .createElementNS (samlp , "saml2p:NameIDPolicy" );
129
- assert pf != null ;
130
- policy .setAttribute ("Format" , PolicyFormat .getPolicyFormatXmlValue (pf ));
128
+ policy .setAttribute ("Format" , policyFormat .trim ());
131
129
policy .setAttribute ("AllowCreate" , "true" );
132
130
policy .setAttribute ("SPNameQualifier" , spname );
133
131
request .appendChild (policy );
@@ -220,7 +218,7 @@ public static String getLoginAttribute(Document doc, String name) {
220
218
221
219
for (int i = 0 ; i < nodes .getLength (); i ++) {
222
220
if (nodes .item (i ).getAttributes ().getNamedItem ("Name" ).getNodeValue ().equals (name )) {
223
- String value = getAttributeContent (nodes .item (i ));
221
+ String value = nodes . item ( i ). getTextContent () == null ? getAttributeContent (nodes .item (i )): nodes . item ( i ). getTextContent ( );
224
222
logger .debug (MessageFormat .format ("getLoginAttribute -- attribute name: {0}, value: {1}" , name , value ));
225
223
return value ;
226
224
}
0 commit comments