本文整理了Java中org.opensaml.saml2.core.Response.setID
方法的一些代码示例,展示了Response.setID
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.setID
方法的具体详情如下:
包路径:org.opensaml.saml2.core.Response
类名称:Response
方法名:setID
暂无
代码示例来源: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: cloudfoundry/uaa
public static Response wrapAssertionIntoResponse(Assertion assertion, String assertionIssuer) {
Response response = new ResponseBuilder().buildObject();
Issuer issuer = new IssuerBuilder().buildObject();
issuer.setValue(assertionIssuer);
response.setIssuer(issuer);
response.setID("id-" + System.currentTimeMillis());
Status stat = new StatusBuilder().buildObject();
// Set the status code
StatusCode statCode = new StatusCodeBuilder().buildObject();
statCode.setValue("urn:oasis:names:tc:SAML:2.0:status:Success");
stat.setStatusCode(statCode);
// Set the status Message
StatusMessage statMesssage = new StatusMessageBuilder().buildObject();
statMesssage.setMessage(null);
stat.setStatusMessage(statMesssage);
response.setStatus(stat);
response.setVersion(SAMLVersion.VERSION_20);
response.setIssueInstant(new DateTime());
response.getAssertions().add(assertion);
//XMLHelper.adoptElement(assertion.getDOM(), assertion.getDOM().getOwnerDocument());
return response;
}
代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.sso.saml.ui
public static String generateErrorneousResponse() {
Response response = new ResponseBuilder().buildObject();
response.setIssuer(getIssuer());
response.setStatus(buildStatus());
response.setVersion(SAMLVersion.VERSION_20);
response.setID(UIDGenerator.generateUID());
try {
return encode(marshall(response));
} catch (IdentityException e) {
if (log.isDebugEnabled()) {
log.debug("Error while encoding.", e);
}
return null;
}
}
代码示例来源: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: org.wso2.carbon.identity.inbound.auth.saml2/org.wso2.carbon.identity.sso.saml.ui
public static String generateErrorneousResponse() {
Response response = new ResponseBuilder().buildObject();
response.setIssuer(getIssuer());
response.setStatus(buildStatus());
response.setVersion(SAMLVersion.VERSION_20);
response.setID(UIDGenerator.generateUID());
try {
return encode(marshall(response));
} catch (IdentityException e) {
if (log.isDebugEnabled()) {
log.debug("Error while encoding.", e);
}
return null;
}
}
代码示例来源:origin: be.fedict.eid-idp/eid-idp-common-saml2
response.setDestination(targetUrl);
String samlResponseId = "saml-response-" + UUID.randomUUID().toString();
response.setID(samlResponseId);
response.setInResponseTo(inResponseTo);
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.setID(SAMLSSOUtil.createID());
response.setDestination(ssoIdPConfigs.getAssertionConsumerUrl());
response.setStatus(buildStatus(SAMLSSOConstants.StatusCodes.SUCCESS_CODE, null));
代码示例来源: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.setStatus(status);
response.setVersion(SAMLVersion.VERSION_20);
response.setID(SAMLSSOUtil.createID());
if (inResponseToID != null) {
response.setInResponseTo(inResponseToID);
response.setID(SAMLSSOUtil.createID());
response.setDestination(ssoIdPConfigs.getAssertionConsumerUrl());
response.setStatus(buildStatus(SAMLSSOConstants.StatusCodes.SUCCESS_CODE, null));
代码示例来源: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.setStatus(status);
response.setVersion(SAMLVersion.VERSION_20);
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());
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);
}
内容来源于网络,如有侵权,请联系作者删除!