@@ -105,7 +105,6 @@ public static Document createLoginRequest(String id, String destination, String
105105 String samlp = "urn:oasis:names:tc:SAML:2.0:protocol" ;
106106 String saml = "urn:oasis:names:tc:SAML:2.0:assertion" ;
107107
108- PolicyFormat pf = PolicyFormat .getPolicyFormat (policyFormat );
109108
110109 DocumentBuilder builder = createDocumentBuilder ();
111110
@@ -126,8 +125,7 @@ public static Document createLoginRequest(String id, String destination, String
126125 request .appendChild (issuerElem );
127126
128127 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 ());
131129 policy .setAttribute ("AllowCreate" , "true" );
132130 policy .setAttribute ("SPNameQualifier" , spname );
133131 request .appendChild (policy );
@@ -220,7 +218,7 @@ public static String getLoginAttribute(Document doc, String name) {
220218
221219 for (int i = 0 ; i < nodes .getLength (); i ++) {
222220 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 ( );
224222 logger .debug (MessageFormat .format ("getLoginAttribute -- attribute name: {0}, value: {1}" , name , value ));
225223 return value ;
226224 }
0 commit comments