+ * Builds the SubjectConfirmation appropriate for this request.
+ *
+ * @param requestContext current request context
+ * @param confirmationMethod confirmation method to use for the request
+ * @param issueInstant issue instant of the response
+ *
+ * @return the constructed subject confirmation
+ */
+ protected SubjectConfirmation buildSubjectConfirmation(BaseSAML2ProfileRequestContext<?, ?, ?> requestContext,
+ String confirmationMethod, DateTime issueInstant) {
+ SubjectConfirmationData confirmationData = subjectConfirmationDataBuilder.buildObject();
+ HTTPInTransport inTransport = (HTTPInTransport) requestContext.getInboundMessageTransport();
+ confirmationData.setAddress(inTransport.getPeerAddress());
+ confirmationData.setInResponseTo(requestContext.getInboundSAMLMessageId());
+ confirmationData.setNotOnOrAfter(issueInstant.plus(requestContext.getProfileConfiguration()
+ .getAssertionLifetime()));
+
+ Endpoint relyingPartyEndpoint = requestContext.getPeerEntityEndpoint();
+ if (relyingPartyEndpoint != null) {
+ if (relyingPartyEndpoint.getResponseLocation() != null) {
+ confirmationData.setRecipient(relyingPartyEndpoint.getResponseLocation());
+ } else {
+ confirmationData.setRecipient(relyingPartyEndpoint.getLocation());
+ }
+ }
+
+ SubjectConfirmation subjectConfirmation = subjectConfirmationBuilder.buildObject();
+ subjectConfirmation.setMethod(confirmationMethod);
+ subjectConfirmation.setSubjectConfirmationData(confirmationData);
+
+ return subjectConfirmation;
+ }
+
+ /**