当前位置: 首页>>代码示例>>Java>>正文


Java StatusCode类代码示例

本文整理汇总了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);
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:26,代码来源:Saml10SuccessResponseView.java

示例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");
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:StatusCodeSchemaValidator.java

示例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);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:StatusUnmarshaller.java

示例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);
}
 
开发者ID:kevin3061,项目名称:cas-4.0.1,代码行数:26,代码来源:Saml10SuccessResponseView.java

示例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;
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:13,代码来源:AbstractSaml10ResponseView.java

示例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));
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:StatusCodeMarshaller.java

示例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);
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:StatusCodeUnmarshaller.java

示例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);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:StatusCodeUnmarshaller.java

示例9: populateRequiredData

import org.opensaml.saml1.core.StatusCode; //导入依赖的package包/类
/** {@inheritDoc} */
protected void populateRequiredData() {
    super.populateRequiredData();

    StatusCode statusCode = (StatusCode) target;
    statusCode.setValue(StatusCode.SUCCESS);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:8,代码来源:StatusCodeSchemaTest.java

示例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));
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:9,代码来源:StatusSchemaTest.java

示例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);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:8,代码来源:StatusCodeTest.java

示例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);
    }
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:12,代码来源:StatusTest.java

示例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);
    }
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:15,代码来源:StatusTest.java

示例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")));
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:5,代码来源:Saml10FailureResponseView.java

示例15: validate

import org.opensaml.saml1.core.StatusCode; //导入依赖的package包/类
/** {@inheritDoc} */
public void validate(StatusCode statusCode) throws ValidationException {
    validateValue(statusCode);
    validateValueContent(statusCode);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:StatusCodeSchemaValidator.java


注:本文中的org.opensaml.saml1.core.StatusCode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。