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

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

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

Response.setDestination介绍

暂无

代码示例

代码示例来源: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: be.fedict.eid-idp/eid-idp-common-saml2

response.setIssueInstant(issueInstant);
response.setVersion(SAMLVersion.VERSION_20);
response.setDestination(targetUrl);
String samlResponseId = "saml-response-" + UUID.randomUUID().toString();
response.setID(samlResponseId);

代码示例来源: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.tools.saml.validator

response.setIssuer(SAMLSSOUtil.getIssuer());
response.setID(SAMLSSOUtil.createID());
response.setDestination(ssoIdPConfigs.getAssertionConsumerUrl());
response.setStatus(buildStatus(SAMLSSOConstants.StatusCodes.SUCCESS_CODE, null));
response.setVersion(SAMLVersion.VERSION_20);

代码示例来源: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.setDestination(destination);

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

response.setIssuer(SAMLSSOUtil.getIssuer());
response.setID(SAMLSSOUtil.createID());
response.setDestination(ssoIdPConfigs.getAssertionConsumerUrl());
response.setStatus(buildStatus(SAMLSSOConstants.StatusCodes.SUCCESS_CODE, null));
response.setVersion(SAMLVersion.VERSION_20);

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

response.setInResponseTo(authReqDTO.getId());
response.setDestination(authReqDTO.getAssertionConsumerURL());
response.setStatus(buildStatus(SAMLSSOConstants.StatusCodes.SUCCESS_CODE, null));
response.setVersion(SAMLVersion.VERSION_20);

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

response.setDestination(destination);

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

response.setInResponseTo(messageContext.getId());
response.setDestination(messageContext.getAssertionConsumerURL());
response.setStatus(buildStatus(SAMLSSOConstants.StatusCodes.SUCCESS_CODE, null));
response.setVersion(SAMLVersion.VERSION_20);

代码示例来源: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);
}

相关文章