本文整理汇总了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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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");
}