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


Java Assertion.setConditions方法代码示例

本文整理汇总了Java中org.opensaml.saml1.core.Assertion.setConditions方法的典型用法代码示例。如果您正苦于以下问题:Java Assertion.setConditions方法的具体用法?Java Assertion.setConditions怎么用?Java Assertion.setConditions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opensaml.saml1.core.Assertion的用法示例。


在下文中一共展示了Assertion.setConditions方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareResponse

import org.opensaml.saml1.core.Assertion; //导入方法依赖的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: processChildElement

import org.opensaml.saml1.core.Assertion; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
        throws UnmarshallingException {

    Assertion assertion = (Assertion) parentSAMLObject;

    if (childSAMLObject instanceof Signature) {
        assertion.setSignature((Signature) childSAMLObject);
    } else if (childSAMLObject instanceof Conditions) {
        assertion.setConditions((Conditions) childSAMLObject);
    } else if (childSAMLObject instanceof Advice) {
        assertion.setAdvice((Advice) childSAMLObject);
    } else if (childSAMLObject instanceof Statement) {
        assertion.getStatements().add((Statement) childSAMLObject);
    } else {
        super.processChildElement(parentSAMLObject, childSAMLObject);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:AssertionUnmarshaller.java

示例3: prepareResponse

import org.opensaml.saml1.core.Assertion; //导入方法依赖的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

示例4: testChildElementsMarshall

import org.opensaml.saml1.core.Assertion; //导入方法依赖的package包/类
/**
 * Test an XML file with Children
 * @throws MarshallingException 
 */

public void testChildElementsMarshall() {
    Assertion assertion = (Assertion) buildXMLObject(qname);
    
    assertion.setConditions((Conditions) buildXMLObject(Conditions.DEFAULT_ELEMENT_NAME));
    assertion.setAdvice((Advice) buildXMLObject(Advice.DEFAULT_ELEMENT_NAME));

    QName authenticationQname = AuthenticationStatement.DEFAULT_ELEMENT_NAME;
    QName authorizationQname = AuthorizationDecisionStatement.DEFAULT_ELEMENT_NAME;
    QName attributeQname = AttributeStatement.DEFAULT_ELEMENT_NAME;
    
    assertion.getStatements().add((Statement) buildXMLObject(authenticationQname));
    assertion.getStatements().add((Statement) buildXMLObject(authorizationQname));
    assertion.getStatements().add((Statement) buildXMLObject(attributeQname));
    assertion.getStatements().add((Statement) buildXMLObject(authenticationQname));
    assertion.getStatements().add((Statement) buildXMLObject(authorizationQname));
    assertion.getStatements().add((Statement) buildXMLObject(attributeQname));
    assertion.getStatements().add((Statement) buildXMLObject(authorizationQname));
    assertion.getStatements().add((Statement) buildXMLObject(attributeQname));

    assertEquals(expectedChildElementsDOM, assertion);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:27,代码来源:AssertionTest.java

示例5: createSAMLAssertion

import org.opensaml.saml1.core.Assertion; //导入方法依赖的package包/类
@Override
public void createSAMLAssertion(DateTime notAfter, DateTime notBefore, String assertionId)
        throws IdentityProviderException {
    assertion = (Assertion) buildXMLObject(Assertion.DEFAULT_ELEMENT_NAME);
    Conditions conditions = (Conditions) buildXMLObject(Conditions.DEFAULT_ELEMENT_NAME);
    conditions.setNotBefore(notBefore);
    conditions.setNotOnOrAfter(notAfter);

    ServerConfiguration config = ServerConfiguration.getInstance();
    String host = "http://" + config.getFirstProperty("HostName");
    assertion.setIssuer(host);
    assertion.setIssueInstant(new DateTime());

    if (appilesTo != null) {
        Audience audience = (Audience) buildXMLObject(Audience.DEFAULT_ELEMENT_NAME);
        audience.setUri(appilesTo);
        AudienceRestrictionCondition audienceRestrictions =
                (AudienceRestrictionCondition) buildXMLObject(AudienceRestrictionCondition.DEFAULT_ELEMENT_NAME);
        audienceRestrictions.getAudiences().add(audience);

        conditions.getAudienceRestrictionConditions().add(audienceRestrictions);
    }

    assertion.setConditions(conditions);

    assertion.getAttributeStatements().add(this.attributeStmt);
    assertion.setID(assertionId);

}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:30,代码来源:SAML1TokenBuilder.java

示例6: testDoNotCache

import org.opensaml.saml1.core.Assertion; //导入方法依赖的package包/类
public void testDoNotCache() {
    Assertion assertion = (Assertion) target;
    QName oqname = new QName(SAMLConstants.SAML1_NS, Conditions.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
    Conditions conditions = (Conditions) buildXMLObject(oqname);
    assertion.setConditions(conditions);
    oqname = new QName(SAMLConstants.SAML1_NS, DoNotCacheCondition.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
    conditions.getConditions().add((Condition) buildXMLObject(oqname));
    assertValidationPass("DoNotCache allowed in SAML 1.1");
    assertion.setVersion(SAMLVersion.VERSION_10);
    assertValidationFail("DoNotCache not allowed in SAML 1.0");
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:12,代码来源:AssertionSpecTest.java


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