Я пытаюсь обеспечить поддержку единого входа с помощью протокола WS-Trust, а целевому приложению требуется SOAP 1.2, а построитель Opensaml SOAP, похоже, имеет только SOAP 1.1. Есть ли какие-либо альтернативы встроенному ответу SOAP1.2.
SAML SOAP ответ, который принимает целевое приложение.
Код: Выделить всё
http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTRC/IssueFinal
urn:uuid:A9990D34-0804-4A61-B486-36B55AA1937F
2024-02-06T07:13:46.347Z
2024-02-06T07:18:46.347Z
Код: Выделить всё
?xml version="1.0" encoding="UTF-8" standalone="no"?>
http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTRC/IssueFinal
Test@123
2024-03-13T13:21:34.976Z
2024-03-13T13:26:34.976Z
Код: Выделить всё
import org.opensaml.ws.soap.soap11.Body;
import org.opensaml.ws.soap.soap11.Envelope;
import org.opensaml.ws.soap.soap11.Header;
import org.opensaml.ws.soap.soap11.impl.BodyBuilder;
import org.opensaml.ws.soap.soap11.impl.EnvelopeBuilder;
import org.opensaml.ws.soap.soap11.impl.HeaderBuilder;
/// other codes
Envelope envelope = new EnvelopeBuilder().buildObject();
// Building Header element
Header header = new HeaderBuilder().buildObject();
Action action = new ActionBuilder().buildObject();
action.setValue(org.opensaml.ws.wstrust.WSTrustConstants.WSA_ACTION_RSTRC_ISSUE_FINAL);
RelatesTo relatesTo = new RelatesToBuilder().buildObject();
relatesTo.setValue(soapRequestValues.getString(SOAP_REQ_MESSAGEID));
// Security Object
Security security = new SecurityBuilder().buildObject();
Timestamp timestamp = new TimestampBuilder().buildObject();
Created created = new CreatedBuilder().buildObject();
created.setDateTime(new DateTime());
Expires expires = new ExpiresBuilder().buildObject();
expires.setDateTime(new DateTime().plusMinutes(5));
timestamp.setCreated(created);
timestamp.setExpires(expires);
security.getUnknownXMLObjects().add(timestamp);
header.getUnknownXMLObjects().add(action);
header.getUnknownXMLObjects().add(relatesTo);
header.getUnknownXMLObjects().add(security);
envelope.setHeader(header);
// body element code
Источник: https://stackoverflow.com/questions/781 ... -open-saml
Мобильная версия