public static String signSamlResponse ( final String samlResponse , final PrivateKey privateKey , final PublicKey publicKey ) { val doc = constructDocumentFromXml ( samlResponse ) ; if ( doc != null ) { val signedElement = signSamlElement ( doc . getRootElement ( ) , privateKey , publicKey ) ; doc . setRootElement ( ( org . jdom . Element ) signedElement . detach ( ) ) ; return new XMLOutputter ( ) . outputString ( doc ) ; } throw new IllegalArgumentException ( "Error signing SAML Response: Null document" ) ; }
Sign SAML response .