本文整理汇总了Java中org.opensaml.saml2.core.Status.setStatusCode方法的典型用法代码示例。如果您正苦于以下问题:Java Status.setStatusCode方法的具体用法?Java Status.setStatusCode怎么用?Java Status.setStatusCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opensaml.saml2.core.Status
的用法示例。
在下文中一共展示了Status.setStatusCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildStatus
import org.opensaml.saml2.core.Status; //导入方法依赖的package包/类
private Status buildStatus(String status, String statMsg) {
Status stat = new StatusBuilder().buildObject();
// Set the status code.
StatusCode statCode = new StatusCodeBuilder().buildObject();
statCode.setValue(status);
stat.setStatusCode(statCode);
// Set the status Message.
if (statMsg != null) {
StatusMessage statMesssage = new StatusMessageBuilder().buildObject();
statMesssage.setMessage(statMsg);
stat.setStatusMessage(statMesssage);
}
return stat;
}
示例2: buildStatus
import org.opensaml.saml2.core.Status; //导入方法依赖的package包/类
private Status buildStatus(String status, String statMsg) {
Status stat = new StatusBuilder().buildObject();
// Set the status code
StatusCode statCode = new StatusCodeBuilder().buildObject();
statCode.setValue(status);
stat.setStatusCode(statCode);
// Set the status Message
if (statMsg != null) {
StatusMessage statMesssage = new StatusMessageBuilder().buildObject();
statMesssage.setMessage(statMsg);
stat.setStatusMessage(statMesssage);
}
return stat;
}
示例3: buildResponse
import org.opensaml.saml2.core.Status; //导入方法依赖的package包/类
/**
* Build the error response
*
* @param inResponseToID
* @param statusCodes
* @param statusMsg
* @return
*/
public Response buildResponse(String inResponseToID, List<String> statusCodes, String statusMsg,
String destination) throws IdentityException {
if (statusCodes == null || statusCodes.isEmpty()) {
throw IdentityException.error("No Status Values");
}
response.setIssuer(SAMLSSOUtil.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(SAMLSSOUtil.createID());
if (inResponseToID != null) {
response.setInResponseTo(inResponseToID);
}
if (destination != null) {
response.setDestination(destination);
}
response.setIssueInstant(new DateTime());
return response;
}
示例4: buildStatus
import org.opensaml.saml2.core.Status; //导入方法依赖的package包/类
private Status buildStatus(String status, String statMsg) {
Status stat = new StatusBuilder().buildObject();
//Set the status code
StatusCode statCode = new StatusCodeBuilder().buildObject();
statCode.setValue(status);
stat.setStatusCode(statCode);
//Set the status Message
if (statMsg != null) {
StatusMessage statMesssage = new StatusMessageBuilder().buildObject();
statMesssage.setMessage(statMsg);
stat.setStatusMessage(statMesssage);
}
return stat;
}
示例5: buildStatus
import org.opensaml.saml2.core.Status; //导入方法依赖的package包/类
/**
* Get status
*
* @param status
* @param statMsg
* @return Status object
*/
private Status buildStatus(String status, String statMsg) {
Status stat = new StatusBuilder().buildObject();
// Set the status code
StatusCode statCode = new StatusCodeBuilder().buildObject();
statCode.setValue(status);
stat.setStatusCode(statCode);
// Set the status Message
if (statMsg != null) {
StatusMessage statMesssage = new StatusMessageBuilder().buildObject();
statMesssage.setMessage(statMsg);
stat.setStatusMessage(statMesssage);
}
return stat;
}
示例6: processChildElement
import org.opensaml.saml2.core.Status; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
throws UnmarshallingException {
Status status = (Status) parentSAMLObject;
if (childSAMLObject instanceof StatusCode) {
status.setStatusCode((StatusCode) childSAMLObject);
} else if (childSAMLObject instanceof StatusMessage) {
status.setStatusMessage((StatusMessage) childSAMLObject);
} else if (childSAMLObject instanceof StatusDetail) {
status.setStatusDetail((StatusDetail) childSAMLObject);
} else {
super.processChildElement(parentSAMLObject, childSAMLObject);
}
}
示例7: createLogoutResponse
import org.opensaml.saml2.core.Status; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private LogoutResponse createLogoutResponse(String id,
String code, String msg) {
// Consume LogoutResponse
LogoutResponse lresp = ((SAMLObjectBuilder<LogoutResponse>)
_bf.getBuilder(LogoutResponse.DEFAULT_ELEMENT_NAME)).
buildObject();
String uid = UUID.randomUUID().toString();
lresp.setID(uid);
lresp.setInResponseTo(id);
lresp.setIssueInstant(new DateTime());
lresp.setVersion(SAMLVersion.VERSION_20);
lresp.setIssuer(getIssuer());
// Set status code
Status status = ((SAMLObjectBuilder<Status>) _bf.getBuilder(
Status.DEFAULT_ELEMENT_NAME)).buildObject();
StatusCode scode = ((SAMLObjectBuilder<StatusCode>) _bf.getBuilder(
StatusCode.DEFAULT_ELEMENT_NAME)).buildObject();
scode.setValue(code);
status.setStatusCode(scode);
if (!msg.equals("")) {
StatusMessage smsg = ((SAMLObjectBuilder<StatusMessage>) _bf.getBuilder(
StatusMessage.DEFAULT_ELEMENT_NAME)).buildObject();
smsg.setMessage(msg);
status.setStatusMessage(smsg);
}
lresp.setStatus(status);
return lresp;
}
示例8: buildStatus
import org.opensaml.saml2.core.Status; //导入方法依赖的package包/类
/**
* Build a SAML Status object
*
* @param pStatusCode Code the the SAML Status Object
* @return SAML Status object
*/
private Status buildStatus(String pStatusCode) {
Status lStatus = new StatusBuilder().buildObject();
// Set the status code
StatusCode lStatusCode = new StatusCodeBuilder().buildObject();
lStatusCode.setValue(pStatusCode);
lStatus.setStatusCode(lStatusCode);
return lStatus;
}
示例9: buildStatus
import org.opensaml.saml2.core.Status; //导入方法依赖的package包/类
private static Status buildStatus() {
Status stat = new StatusBuilder().buildObject();
//Set the status code
StatusCode statCode = new StatusCodeBuilder().buildObject();
statCode.setValue("urn:oasis:names:tc:SAML:2.0:status:Responder");
stat.setStatusCode(statCode);
StatusMessage statMesssage = new StatusMessageBuilder().buildObject();
statMesssage.setMessage("Error when processing the Authentication Request");
stat.setStatusMessage(statMesssage);
return stat;
}
示例10: populateRequiredData
import org.opensaml.saml2.core.Status; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void populateRequiredData() {
super.populateRequiredData();
Status status = (Status) target;
StatusCode code = (StatusCode) buildXMLObject(new QName(SAMLConstants.SAML20P_NS, StatusCode.DEFAULT_ELEMENT_LOCAL_NAME));
status.setStatusCode(code);
}
示例11: testChildElementsMarshall
import org.opensaml.saml2.core.Status; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsMarshall() {
QName qname = new QName(SAMLConstants.SAML20P_NS, Status.DEFAULT_ELEMENT_LOCAL_NAME);
Status status = (Status) buildXMLObject(qname);
QName statusCodeQName = new QName(SAMLConstants.SAML20P_NS, StatusCode.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX);
status.setStatusCode((StatusCode) buildXMLObject(statusCodeQName));
QName statusMessageQName = new QName(SAMLConstants.SAML20P_NS, StatusMessage.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX);
status.setStatusMessage((StatusMessage) buildXMLObject(statusMessageQName));
assertEquals(expectedChildElementsDOM, status);
}
示例12: createStatus
import org.opensaml.saml2.core.Status; //导入方法依赖的package包/类
private Status createStatus() {
StatusCodeBuilder statusCodeBuilder = new StatusCodeBuilder();
StatusCode statusCode = statusCodeBuilder.buildObject();
statusCode.setValue(StatusCode.SUCCESS_URI);
StatusBuilder statusBuilder = new StatusBuilder();
Status status = statusBuilder.buildObject();
status.setStatusCode(statusCode);
return status;
}
示例13: buildMockResponse
import org.opensaml.saml2.core.Status; //导入方法依赖的package包/类
private Response buildMockResponse() throws Exception {
Response samlMessage = new ResponseBuilder().buildObject();
samlMessage.setID("foo");
samlMessage.setVersion(SAMLVersion.VERSION_20);
samlMessage.setIssueInstant(new DateTime(0));
Issuer issuer = new IssuerBuilder().buildObject();
issuer.setValue("MockedIssuer");
samlMessage.setIssuer(issuer);
Status status = new StatusBuilder().buildObject();
StatusCode statusCode = new StatusCodeBuilder().buildObject();
statusCode.setValue(StatusCode.SUCCESS_URI);
status.setStatusCode(statusCode);
samlMessage.setStatus(status);
Assertion assertion = new AssertionBuilder().buildObject();
Subject subject = new SubjectBuilder().buildObject();
NameID nameID = new NameIDBuilder().buildObject();
nameID.setValue("SOME-UNIQUE-ID");
nameID.setFormat(NameIDType.PERSISTENT);
subject.setNameID(nameID);
assertion.setSubject(subject);
AuthnStatement authnStatement = new AuthnStatementBuilder().buildObject();
authnStatement.setSessionIndex("Some Session String");
assertion.getAuthnStatements().add(authnStatement);
AttributeStatement attributeStatement = new AttributeStatementBuilder().buildObject();
assertion.getAttributeStatements().add(attributeStatement);
samlMessage.getAssertions().add(assertion);
return samlMessage;
}
示例14: createStatus
import org.opensaml.saml2.core.Status; //导入方法依赖的package包/类
private static Status createStatus() {
Status status = null;
if (samlResponseData.getStatusCodeValue() != null
&& samlResponseData.getStatusCodeValue().length() > 0) {
StatusCode statusCodeElement = create(StatusCode.DEFAULT_ELEMENT_NAME);
statusCodeElement.setValue(samlResponseData.getStatusCodeValue());
status = create(Status.DEFAULT_ELEMENT_NAME);
status.setStatusCode(statusCodeElement);
}
return status;
}
示例15: testResponseEncoding
import org.opensaml.saml2.core.Status; //导入方法依赖的package包/类
/**
* Tests encoding a SAML message to an servlet response.
*
* @throws Exception
*/
@SuppressWarnings("unchecked")
public void testResponseEncoding() throws Exception {
SAMLObjectBuilder<StatusCode> statusCodeBuilder = (SAMLObjectBuilder<StatusCode>) builderFactory
.getBuilder(StatusCode.DEFAULT_ELEMENT_NAME);
StatusCode statusCode = statusCodeBuilder.buildObject();
statusCode.setValue(StatusCode.SUCCESS_URI);
SAMLObjectBuilder<Status> statusBuilder = (SAMLObjectBuilder<Status>) builderFactory
.getBuilder(Status.DEFAULT_ELEMENT_NAME);
Status responseStatus = statusBuilder.buildObject();
responseStatus.setStatusCode(statusCode);
SAMLObjectBuilder<Response> responseBuilder = (SAMLObjectBuilder<Response>) builderFactory
.getBuilder(Response.DEFAULT_ELEMENT_NAME);
Response samlMessage = responseBuilder.buildObject();
samlMessage.setID("foo");
samlMessage.setVersion(SAMLVersion.VERSION_20);
samlMessage.setIssueInstant(new DateTime(0));
samlMessage.setStatus(responseStatus);
SAMLObjectBuilder<Endpoint> endpointBuilder = (SAMLObjectBuilder<Endpoint>) builderFactory
.getBuilder(AssertionConsumerService.DEFAULT_ELEMENT_NAME);
Endpoint samlEndpoint = endpointBuilder.buildObject();
samlEndpoint.setLocation("http://example.org");
samlEndpoint.setResponseLocation("http://example.org/response");
MockHttpServletResponse response = new MockHttpServletResponse();
HttpServletResponseAdapter outTransport = new HttpServletResponseAdapter(response, false);
BasicSAMLMessageContext messageContext = new BasicSAMLMessageContext();
messageContext.setOutboundMessageTransport(outTransport);
messageContext.setPeerEntityEndpoint(samlEndpoint);
messageContext.setOutboundSAMLMessage(samlMessage);
messageContext.setRelayState("relay");
HTTPPostEncoder encoder = new HTTPPostEncoder(velocityEngine,
"/templates/saml2-post-binding.vm");
encoder.encode(messageContext);
assertEquals("Unexpected content type", "text/html", response.getContentType());
assertEquals("Unexpected character encoding", response.getCharacterEncoding(), "UTF-8");
assertEquals("Unexpected cache controls", "no-cache, no-store", response.getHeader("Cache-control"));
assertEquals(762244719, response.getContentAsString().hashCode());
}