org.opensaml.saml2.core.Response.setInResponseTo()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.opensaml.saml2.core.Response.setInResponseTo方法的一些代码示例,展示了Response.setInResponseTo的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.setInResponseTo方法的具体详情如下:
包路径:org.opensaml.saml2.core.Response
类名称:Response
方法名:setInResponseTo

Response.setInResponseTo介绍

暂无

代码示例

代码示例来源:origin: cloudfoundry/uaa

private void buildCommonAttributes(String localEntityId, Response response, Endpoint service,
                  AuthnRequest authnRequest) {
  response.setID(generateID());
  response.setIssuer(getIssuer(localEntityId));
  response.setInResponseTo(authnRequest.getID());
  response.setVersion(SAMLVersion.VERSION_20);
  response.setIssueInstant(new DateTime());
  if (service != null) {
    response.setDestination(service.getLocation());
  }
}

代码示例来源:origin: se.skltp.adapterservices.se.apotekensservice/TicketMachine

@Override
  public Response build() {
    Response saml2Response = new ResponseBuilder().buildObject();
    saml2Response.setIssueInstant(issueInstant);
    saml2Response.setVersion(SAMLVersion.VERSION_20);
    saml2Response.setID(id);
    saml2Response.setInResponseTo(inResponseTo);
    saml2Response.setIssuer(issuer);
    saml2Response.setStatus(status);
    saml2Response.setSignature(signature);
    if(assertions.size() >0){
      for (Assertion assertion : assertions) {
        saml2Response.getAssertions().add(assertion);
      }
    }
    return saml2Response;
  }
}

代码示例来源:origin: be.fedict.eid-idp/eid-idp-common-saml2

String samlResponseId = "saml-response-" + UUID.randomUUID().toString();
response.setID(samlResponseId);
response.setInResponseTo(inResponseTo);

代码示例来源:origin: org.wso2.carbon.identity.inbound.auth.saml2/org.wso2.carbon.identity.authenticator.inbound.saml2sso

protected Response buildErrorResponse(String inResponseToId, List<String> statusCodes, String statusMsg,
                   String destination) {
  if (statusCodes == null || statusCodes.isEmpty()) {
    return null;
  }
  Response response = new ResponseBuilder().buildObject();
  response.setIssuer(getIssuer());
  Status status = new StatusBuilder().buildObject();
  StatusCode statusCode = null;
  for (String statCode : statusCodes) {
    statusCode = buildStatusCode(statCode, statusCode);
  }
  status.setStatusCode(statusCode);
  buildStatusMsg(status, statusMsg);
  response.setStatus(status);
  response.setVersion(SAMLVersion.VERSION_20);
  response.setID(SAML2AuthUtils.createID());
  if (StringUtils.isNotBlank(inResponseToId)) {
    response.setInResponseTo(inResponseToId);
  }
  if (destination != null) {
    response.setDestination(destination);
  }
  response.setIssueInstant(new DateTime());
  return response;
}

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.sso.saml

public Response buildResponse(SAMLSSOAuthnReqDTO authReqDTO, Assertion assertion)
    throws IdentityException {
  if (log.isDebugEnabled()) {
    log.debug("Building SAML Response for the consumer '"
        + authReqDTO.getAssertionConsumerURL() + "'");
  }
  Response response = new org.opensaml.saml2.core.impl.ResponseBuilder().buildObject();
  response.setIssuer(SAMLSSOUtil.getIssuer());
  response.setID(SAMLSSOUtil.createID());
  response.setInResponseTo(authReqDTO.getId());
  response.setDestination(authReqDTO.getAssertionConsumerURL());
  response.setStatus(buildStatus(SAMLSSOConstants.StatusCodes.SUCCESS_CODE, null));
  response.setVersion(SAMLVersion.VERSION_20);
  DateTime issueInstant = new DateTime();
  response.setIssueInstant(issueInstant);
  response.getAssertions().add(assertion);
  if (authReqDTO.isDoSignResponse()) {
    SAMLSSOUtil.setSignature(response, authReqDTO.getSigningAlgorithmUri(), authReqDTO.getDigestAlgorithmUri
        (), new SignKeyDataHolder(authReqDTO.getUser().getAuthenticatedSubjectIdentifier()));
  }
  return response;
}

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.sso.saml

response.setID(SAMLSSOUtil.createID());
if (inResponseToID != null) {
  response.setInResponseTo(inResponseToID);

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.sso.saml

response.setID(SAMLSSOUtil.createID());
if (!authReqDTO.isIdPInitSSOEnabled()) {
  response.setInResponseTo(authReqDTO.getId());

代码示例来源:origin: org.wso2.carbon.identity.inbound.auth.saml.cloud/org.wso2.carbon.identity.sso.saml.cloud

response.setID(SAMLSSOUtil.createID());
if (inResponseToID != null) {
  response.setInResponseTo(inResponseToID);

代码示例来源:origin: org.wso2.carbon.identity.inbound.auth.saml.cloud/org.wso2.carbon.identity.sso.saml.cloud

response.setID(SAMLSSOUtil.createID());
if (!messageContext.isIdpInitSSO()) {
  response.setInResponseTo(messageContext.getId());

代码示例来源:origin: org.wso2.carbon.identity.inbound.auth.saml2/org.wso2.carbon.identity.authenticator.inbound.saml2sso

protected Response buildSAMLResponse(String subject, Set<Claim> claims, SAML2SSOContext saml2SSOContext,
                   ResponseBuilderConfig config, AuthenticationContext context)
    throws SAML2SSOResponseBuilderException {
  Response response = new ResponseBuilder().buildObject();
  response.setIssuer(getIssuer());
  response.setID(SAML2AuthUtils.createID());
  if (!saml2SSOContext.isIdpInitSSO()) {
    response.setInResponseTo(saml2SSOContext.getId());
  }
  response.setDestination(saml2SSOContext.getAssertionConsumerURL());
  buildStatus(response, StatusCode.SUCCESS_URI, null);
  response.setVersion(SAMLVersion.VERSION_20);
  DateTime issueInstant = new DateTime();
  response.setIssueInstant(issueInstant);
  buildAssertion(subject, claims, response, issueInstant, saml2SSOContext, config, context);
  if (config.signResponse()) {
    SAML2AuthUtils.setSignature(response, config.getSigningAlgorithmUri(), config
        .getDigestAlgorithmUri(), true, SAML2AuthUtils.getServerCredentials());
  }
  return response;
}

代码示例来源:origin: OpenConext/Mujina

@SuppressWarnings("unchecked")
public void sendAuthnResponse(SAMLPrincipal principal, HttpServletResponse response) throws MarshallingException, SignatureException, MessageEncodingException {
 Status status = buildStatus(StatusCode.SUCCESS_URI);
 String entityId = idpConfiguration.getEntityId();
 Credential signingCredential = resolveCredential(entityId);
 Response authResponse = buildSAMLObject(Response.class, Response.DEFAULT_ELEMENT_NAME);
 Issuer issuer = buildIssuer(entityId);
 authResponse.setIssuer(issuer);
 authResponse.setID(SAMLBuilder.randomSAMLId());
 authResponse.setIssueInstant(new DateTime());
 authResponse.setInResponseTo(principal.getRequestID());
 Assertion assertion = buildAssertion(principal, status, entityId);
 signAssertion(assertion, signingCredential);
 authResponse.getAssertions().add(assertion);
 authResponse.setDestination(principal.getAssertionConsumerServiceURL());
 authResponse.setStatus(status);
 Endpoint endpoint = buildSAMLObject(Endpoint.class, SingleSignOnService.DEFAULT_ELEMENT_NAME);
 endpoint.setLocation(principal.getAssertionConsumerServiceURL());
 HttpServletResponseAdapter outTransport = new HttpServletResponseAdapter(response, false);
 BasicSAMLMessageContext messageContext = new BasicSAMLMessageContext();
 messageContext.setOutboundMessageTransport(outTransport);
 messageContext.setPeerEntityEndpoint(endpoint);
 messageContext.setOutboundSAMLMessage(authResponse);
 messageContext.setOutboundSAMLMessageSigningCredential(signingCredential);
 messageContext.setOutboundMessageIssuer(entityId);
 messageContext.setRelayState(principal.getRelayState());
 encoder.encode(messageContext);
}

相关文章