@@ -50,24 +50,24 @@ public void loadXmlFromBase64(String response) throws ParserConfigurationExcepti
5050 loadXml (decodedS );
5151 }
5252
53- public boolean isValid () throws Exception {
54- NodeList nodes = xmlDoc .getElementsByTagNameNS (XMLSignature .XMLNS , "Signature" );
55-
56- if (nodes ==null || nodes .getLength ()==0 ){
57- throw new Exception ("Can't find signature in document." );
58- }
53+ public boolean isValid () throws Exception {
54+ NodeList nodes = xmlDoc .getElementsByTagNameNS (XMLSignature .XMLNS , "Signature" );
5955
60- if (setIdAttributeExists () ) {
61- tagIdAttributes ( xmlDoc );
62- }
56+ if (nodes == null || nodes . getLength () == 0 ) {
57+ throw new Exception ( "Can't find signature in document." );
58+ }
6359
64- X509Certificate cert = certificate .getX509Cert ();
65- DOMValidateContext ctx = new DOMValidateContext (cert .getPublicKey () , nodes .item (0 ));
66- XMLSignatureFactory sigF = XMLSignatureFactory .getInstance ("DOM" );
67- XMLSignature xmlSignature = sigF .unmarshalXMLSignature (ctx );
60+ if (setIdAttributeExists ()) {
61+ tagIdAttributes (xmlDoc );
62+ }
63+
64+ X509Certificate cert = certificate .getX509Cert ();
65+ DOMValidateContext ctx = new DOMValidateContext (cert .getPublicKey (), nodes .item (0 ));
66+ XMLSignatureFactory sigF = XMLSignatureFactory .getInstance ("DOM" );
67+ XMLSignature xmlSignature = sigF .unmarshalXMLSignature (ctx );
6868
69- return xmlSignature .validate (ctx );
70- }
69+ return xmlSignature .validate (ctx );
70+ }
7171
7272 public String getNameId () throws Exception {
7373 NodeList nodes = xmlDoc .getElementsByTagNameNS ("urn:oasis:names:tc:SAML:2.0:assertion" , "NameID" );
0 commit comments