本文整理汇总了Java中org.opensaml.saml1.core.StatusCode类的典型用法代码示例。如果您正苦于以下问题:Java StatusCode类的具体用法?Java StatusCode怎么用?Java StatusCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StatusCode类属于org.opensaml.saml1.core包,在下文中一共展示了StatusCode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareResponse
import org.opensaml.saml1.core.StatusCode; //导入依赖的package包/类
@Override
protected void prepareResponse(final Response response, final Map<String, Object> model) {
final Authentication authentication = getAssertionFrom(model).getPrimaryAuthentication();
final DateTime issuedAt = response.getIssueInstant();
final Service service = getAssertionFrom(model).getService();
final Object o = authentication.getAttributes().get(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME);
final boolean isRemembered = o == Boolean.TRUE && !getAssertionFrom(model).isFromNewLogin();
// Build up the SAML assertion containing AuthenticationStatement and AttributeStatement
final Assertion assertion = newSamlObject(Assertion.class);
assertion.setID(generateId());
assertion.setIssueInstant(issuedAt);
assertion.setIssuer(this.issuer);
assertion.setConditions(newConditions(issuedAt, service.getId()));
final AuthenticationStatement authnStatement = newAuthenticationStatement(authentication);
assertion.getAuthenticationStatements().add(authnStatement);
final Map<String, Object> attributes = authentication.getPrincipal().getAttributes();
if (!attributes.isEmpty() || isRemembered) {
assertion.getAttributeStatements().add(
newAttributeStatement(newSubject(authentication.getPrincipal().getId()), attributes, isRemembered));
}
response.setStatus(newStatus(StatusCode.SUCCESS, null));
response.getAssertions().add(assertion);
}
示例2: validateValueContent
import org.opensaml.saml1.core.StatusCode; //导入依赖的package包/类
/**
* Validates that the status code local name is one of the allowabled values.
*
* @param statusCode the status code to validate
*
* @throws ValidationException thrown if the status code local name is not an allowed value
*/
protected void validateValueContent(StatusCode statusCode) throws ValidationException {
QName statusValue = statusCode.getValue();
if (SAMLConstants.SAML10P_NS.equals(statusValue.getNamespaceURI())) {
if (!(statusValue.equals(StatusCode.SUCCESS)
|| statusValue.equals(StatusCode.VERSION_MISMATCH)
|| statusValue.equals(StatusCode.REQUESTER)
|| statusValue.equals(StatusCode.RESPONDER)
|| statusValue.equals(StatusCode.REQUEST_VERSION_TOO_HIGH)
|| statusValue.equals(StatusCode.REQUEST_VERSION_TOO_LOW)
|| statusValue.equals(StatusCode.REQUEST_VERSION_DEPRICATED)
|| statusValue.equals(StatusCode.TOO_MANY_RESPONSES)
|| statusValue.equals(StatusCode.REQUEST_DENIED)
|| statusValue.equals(StatusCode.RESOURCE_NOT_RECOGNIZED))) {
throw new ValidationException(
"Status code value was in the SAML 1 protocol namespace but was not of an allowed value: "
+ statusValue);
}
} else if (SAMLConstants.SAML1_NS.equals(statusValue.getNamespaceURI())) {
throw new ValidationException(
"Status code value was in the SAML 1 assertion namespace, no values are allowed in that namespace");
}
}
示例3: processChildElement
import org.opensaml.saml1.core.StatusCode; //导入依赖的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);
}
}
示例4: prepareResponse
import org.opensaml.saml1.core.StatusCode; //导入依赖的package包/类
@Override
protected void prepareResponse(final Response response, final Map<String, Object> model) {
final Authentication authentication = getAssertionFrom(model).getChainedAuthentications().get(0);
final DateTime issuedAt = response.getIssueInstant();
final Service service = getAssertionFrom(model).getService();
final Object o = authentication.getAttributes().get(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME);
final boolean isRemembered = o == Boolean.TRUE && !getAssertionFrom(model).isFromNewLogin();
// Build up the SAML assertion containing AuthenticationStatement and AttributeStatement
final Assertion assertion = newSamlObject(Assertion.class);
assertion.setID(generateId());
assertion.setIssueInstant(issuedAt);
assertion.setIssuer(this.issuer);
assertion.setConditions(newConditions(issuedAt, service.getId()));
final AuthenticationStatement authnStatement = newAuthenticationStatement(authentication);
assertion.getAuthenticationStatements().add(authnStatement);
final Map<String, Object> attributes = authentication.getPrincipal().getAttributes();
if (!attributes.isEmpty() || isRemembered) {
assertion.getAttributeStatements().add(
newAttributeStatement(newSubject(authentication.getPrincipal().getId()), attributes, isRemembered));
}
response.setStatus(newStatus(StatusCode.SUCCESS, null));
response.getAssertions().add(assertion);
}
示例5: newStatus
import org.opensaml.saml1.core.StatusCode; //导入依赖的package包/类
protected final Status newStatus(final QName codeValue, final String statusMessage) {
final Status status = newSamlObject(Status.class);
final StatusCode code = newSamlObject(StatusCode.class);
code.setValue(codeValue);
status.setStatusCode(code);
if (statusMessage != null) {
final StatusMessage message = newSamlObject(StatusMessage.class);
message.setMessage(statusMessage);
status.setStatusMessage(message);
}
return status;
}
示例6: marshallAttributes
import org.opensaml.saml1.core.StatusCode; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException {
StatusCode statusCode = (StatusCode) samlElement;
QName statusValue = statusCode.getValue();
if (statusValue != null) {
domElement.setAttributeNS(null, StatusCode.VALUE_ATTRIB_NAME, XMLHelper.qnameToContentString(statusValue));
}
}
示例7: processChildElement
import org.opensaml.saml1.core.StatusCode; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
throws UnmarshallingException {
StatusCode statusCode = (StatusCode) parentSAMLObject;
if (childSAMLObject instanceof StatusCode) {
statusCode.setStatusCode((StatusCode) childSAMLObject);
} else {
super.processChildElement(parentSAMLObject, childSAMLObject);
}
}
示例8: processAttribute
import org.opensaml.saml1.core.StatusCode; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
StatusCode statusCode = (StatusCode) samlObject;
if (attribute.getName().equals(StatusCode.VALUE_ATTRIB_NAME)) {
statusCode.setValue(XMLHelper.getAttributeValueAsQName(attribute));
} else {
super.processAttribute(samlObject, attribute);
}
}
示例9: populateRequiredData
import org.opensaml.saml1.core.StatusCode; //导入依赖的package包/类
/** {@inheritDoc} */
protected void populateRequiredData() {
super.populateRequiredData();
StatusCode statusCode = (StatusCode) target;
statusCode.setValue(StatusCode.SUCCESS);
}
示例10: populateRequiredData
import org.opensaml.saml1.core.StatusCode; //导入依赖的package包/类
/** {@inheritDoc} */
protected void populateRequiredData() {
super.populateRequiredData();
Status status = (Status) target;
QName qname = new QName(SAMLConstants.SAML10P_NS, StatusCode.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1P_PREFIX);
status.setStatusCode((StatusCode)buildXMLObject(qname));
}
示例11: StatusCodeTest
import org.opensaml.saml1.core.StatusCode; //导入依赖的package包/类
/**Constructor. */
public StatusCodeTest() {
childElementsFile = "/data/org/opensaml/saml1/impl/FullStatusCode.xml";
singleElementFile = "/data/org/opensaml/saml1/impl/singleStatusCode.xml";
qname = new QName(SAMLConstants.SAML10P_NS, StatusCode.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1P_PREFIX);
}
示例12: testSingleElementMarshall
import org.opensaml.saml1.core.StatusCode; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementMarshall() {
Status status = (Status) buildXMLObject(qname);
StatusCode statusCode = (StatusCode) buildXMLObject(StatusCode.DEFAULT_ELEMENT_NAME);
statusCode.setValue(StatusCode.SUCCESS);
status.setStatusCode(statusCode);
assertEquals(expectedDOM, status);
}
示例13: testChildElementsMarshall
import org.opensaml.saml1.core.StatusCode; //导入依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsMarshall() {
Status status = (Status) buildXMLObject(qname);
StatusCode statusCode = (StatusCode) buildXMLObject(StatusCode.DEFAULT_ELEMENT_NAME);
statusCode.setValue(StatusCode.SUCCESS);
status.setStatusCode(statusCode);
StatusMessage statusMessage = (StatusMessage) buildXMLObject(StatusMessage.DEFAULT_ELEMENT_NAME);
status.setStatusMessage(statusMessage);
assertEquals(expectedChildElementsDOM, status);
}
示例14: prepareResponse
import org.opensaml.saml1.core.StatusCode; //导入依赖的package包/类
@Override
protected void prepareResponse(final Response response, final Map<String, Object> model) {
response.setStatus(newStatus(StatusCode.REQUEST_DENIED, (String) model.get("description")));
}
示例15: validate
import org.opensaml.saml1.core.StatusCode; //导入依赖的package包/类
/** {@inheritDoc} */
public void validate(StatusCode statusCode) throws ValidationException {
validateValue(statusCode);
validateValueContent(statusCode);
}