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

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

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

Response.setID介绍

暂无

代码示例

代码示例来源:origin: line/armeria

response.getAssertions().add(assertion);
response.setID(requestIdManager.newId());
response.setIssuer(issuer);
response.setIssueInstant(DateTime.now());

代码示例来源:origin: codice/ddf

public static Response createResponse(
  Issuer issuer, Status status, String requestId, Element samlAssertion)
  throws WSSecurityException {
 Response response = responseSAMLObjectBuilder.buildObject();
 response.setIssuer(issuer);
 response.setStatus(status);
 response.setID("_" + UUID.randomUUID().toString());
 response.setIssueInstant(new DateTime());
 response.setInResponseTo(requestId);
 response.setVersion(SAMLVersion.VERSION_20);
 if (samlAssertion != null) {
  SamlAssertionWrapper samlAssertionWrapper = new SamlAssertionWrapper(samlAssertion);
  response.getAssertions().add(samlAssertionWrapper.getSaml2());
 }
 return response;
}

代码示例来源:origin: org.apache.cxf.fediz/fediz-idp-core

@SuppressWarnings("unchecked")
public static Response createSAMLResponse(
  String inResponseTo,
  String issuer,
  Status status
) {
  if (responseBuilder == null) {
    responseBuilder = (SAMLObjectBuilder<Response>)
      builderFactory.getBuilder(Response.DEFAULT_ELEMENT_NAME);
  }
  Response response = responseBuilder.buildObject();
  response.setID(UUID.randomUUID().toString());
  response.setIssueInstant(new DateTime());
  response.setInResponseTo(inResponseTo);
  response.setIssuer(createIssuer(issuer));
  response.setStatus(status);
  response.setVersion(SAMLVersion.VERSION_20);
  return response;
}

代码示例来源:origin: org.jasig.cas/cas-server-support-saml

/**
 * Create a new SAML response object.
 * @param id the id
 * @param issueInstant the issue instant
 * @param recipient the recipient
 * @param service the service
 * @return the response
 */
public Response newResponse(final String id, final DateTime issueInstant,
              final String recipient, final WebApplicationService service) {
  final Response samlResponse = newSamlObject(Response.class);
  samlResponse.setID(id);
  samlResponse.setIssueInstant(issueInstant);
  samlResponse.setVersion(SAMLVersion.VERSION_20);
  if (service instanceof SamlService) {
    final SamlService samlService = (SamlService) service;
    final String requestId = samlService.getRequestID();
    if (StringUtils.isNotBlank(requestId)) {
      samlResponse.setInResponseTo(requestId);
    }
  }
  return samlResponse;
}

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

/**
 * This method is used to build error response when request contain validation or
 * processing errors
 *
 * @param invalidItem List of invalid items (violations)
 * @return Response element which contain error status and error message
 * @throws IdentitySAML2QueryException If unable to collect issuer
 */
public static Response build(List<InvalidItemDTO> invalidItem) throws IdentitySAML2QueryException {
  Response response = new ResponseBuilder().buildObject();
  response.setIssuer(OpenSAML3Util.getIssuer(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME));
  response.setID(SAMLSSOUtil.createID());
  String statusCode = "";
  String statusMessage = "";
  //selecting Status Code
  if (invalidItem.size() > 0) {
    statusMessage = invalidItem.get(0).getMessage();
    statusCode = invalidItem.get(0).getValidationType();
    statusCode = filterStatusCode(statusCode);
  }
  response.setStatus(buildStatus(statusCode, statusMessage));
  response.setVersion(SAMLVersion.VERSION_20);
  DateTime issueInstant = new DateTime();
  response.setIssueInstant(issueInstant);
  return response;
}

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

response.setID(SAMLSSOUtil.createID());
response.setStatus(buildStatus(SAMLSSOConstants.StatusCodes.SUCCESS_CODE, null));
response.setVersion(SAMLVersion.VERSION_20);

代码示例来源:origin: spring-projects/spring-security-saml

protected org.opensaml.saml.saml2.core.Response internalToXml(Response response) {
  org.opensaml.saml.saml2.core.Response result = buildSAMLObject(org.opensaml.saml.saml2.core.Response.class);
  result.setConsent(response.getConsent());
  result.setID(ofNullable(response.getId()).orElse("a" + UUID.randomUUID().toString()));
  result.setInResponseTo(response.getInResponseTo());
  result.setVersion(SAMLVersion.VERSION_20);

相关文章