Closed vincenzocorso closed 2 years ago
Ho risolto. E' necessario richiamare il metodo Signer.signObject nel metodo printAuthnRequest
Il problema era dato dal fatto che gli elementi <SignatureValue/>
e <DigestValue/>
erano vuoti.
public String printAuthnRequest(AuthnRequest authnRequest) throws IntegrationServiceException {
Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(authnRequest); // object to DOM converter
Element authDOM;
try {
authDOM = marshaller.marshall(authnRequest);
}
catch (MarshallingException e) {
log.error("printAuthnRequest :: " + e.getMessage(), e);
throw new IntegrationServiceException(e);
}
/* Bisogna richiamare questo metodo */
try {
Signer.signObject(authnRequest.getSignature());
} catch (SignatureException e) {
e.printStackTrace();
}
// converting to a DOM
StringWriter requestWriter = new StringWriter();
requestWriter = new StringWriter();
XMLHelper.writeNode(authDOM, requestWriter);
String authnRequestString = requestWriter.toString(); // DOM to string
return authnRequestString;
}
Salve quando provo a generare una richiesta, l'elemento
<SignatureValue />
è vuoto. Questo causa il seguente errore durante la richiesta post diretta allo spid test env:TypeError: argument should be a bytes-like object or ASCII string, not 'NoneType'
Un esempio di richiesta generata è il seguente: