本文整理汇总了Java中org.opensaml.saml1.core.Conditions类的典型用法代码示例。如果您正苦于以下问题:Java Conditions类的具体用法?Java Conditions怎么用?Java Conditions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Conditions类属于org.opensaml.saml1.core包,在下文中一共展示了Conditions类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: processChildElement
import org.opensaml.saml1.core.Conditions; //导入依赖的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
示例2: ConditionsTest
import org.opensaml.saml1.core.Conditions; //导入依赖的package包/类
/**
* Constructor
*
*/
public ConditionsTest() {
singleElementFile = "/data/org/opensaml/saml1/impl/singleConditions.xml";
singleElementOptionalAttributesFile = "/data/org/opensaml/saml1/impl/singleConditionsAttributes.xml";
childElementsFile = "/data/org/opensaml/saml1/impl/ConditionsWithChildren.xml";
//
// NotBefore="1970-01-01T01:00:00.123Z"
//
expectedNotBeforeDate = new DateTime(1970, 1, 01, 01, 00, 00, 123, ISOChronology.getInstanceUTC());
//
// NotOnOrAfter="1970-01-01T00:00:01.000Z"
//
expectedNotOnOfAfter = new DateTime(1970, 1, 01, 00, 00, 01, 0, ISOChronology.getInstanceUTC());
qname = new QName(SAMLConstants.SAML1_NS, Conditions.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
}
开发者ID:apigee,项目名称:java-opensaml2,代码行数:20,代码来源:ConditionsTest.java
示例3: testChildElementsMarshall
import org.opensaml.saml1.core.Conditions; //导入依赖的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
示例4: newConditions
import org.opensaml.saml1.core.Conditions; //导入依赖的package包/类
private Conditions newConditions(final DateTime issuedAt, final String serviceId) {
final Conditions conditions = newSamlObject(Conditions.class);
conditions.setNotBefore(issuedAt);
conditions.setNotOnOrAfter(issuedAt.plus(this.issueLength));
final AudienceRestrictionCondition audienceRestriction = newSamlObject(AudienceRestrictionCondition.class);
final Audience audience = newSamlObject(Audience.class);
audience.setUri(serviceId);
audienceRestriction.getAudiences().add(audience);
conditions.getAudienceRestrictionConditions().add(audienceRestriction);
return conditions;
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:12,代码来源:Saml10SuccessResponseView.java
示例5: validateDoNotCache
import org.opensaml.saml1.core.Conditions; //导入依赖的package包/类
protected void validateDoNotCache(Assertion assertion) throws ValidationException {
if (assertion.getMinorVersion() == 0) {
Conditions conditions = assertion.getConditions();
if (conditions != null) {
for (Condition condition : conditions.getConditions()) {
if (condition instanceof DoNotCacheCondition) {
throw new ValidationException("DoNotCacheCondition not valid in SAML1.0");
}
}
}
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:AssertionSpecValidator.java
示例6: processChildElement
import org.opensaml.saml1.core.Conditions; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
throws UnmarshallingException {
Conditions conditions = (Conditions) parentSAMLObject;
if (childSAMLObject instanceof Condition) {
conditions.getConditions().add((Condition) childSAMLObject);
} else {
super.processChildElement(parentSAMLObject, childSAMLObject);
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:ConditionsUnmarshaller.java
示例7: processAttribute
import org.opensaml.saml1.core.Conditions; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
Conditions conditions = (Conditions) samlObject;
if (Conditions.NOTBEFORE_ATTRIB_NAME.equals(attribute.getLocalName())
&& !DatatypeHelper.isEmpty(attribute.getValue())) {
conditions.setNotBefore(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
} else if (Conditions.NOTONORAFTER_ATTRIB_NAME.equals(attribute.getLocalName())
&& !DatatypeHelper.isEmpty(attribute.getValue())) {
conditions.setNotOnOrAfter(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
} else {
processAttribute(samlObject, attribute);
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:ConditionsUnmarshaller.java
示例8: createSAMLAssertion
import org.opensaml.saml1.core.Conditions; //导入依赖的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
示例9: testDoNotCache
import org.opensaml.saml1.core.Conditions; //导入依赖的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
示例10: testSingleElementOptionalAttributesMarshall
import org.opensaml.saml1.core.Conditions; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementOptionalAttributesMarshall() {
Conditions conditions = (Conditions) buildXMLObject(qname);
conditions.setNotBefore(expectedNotBeforeDate);
conditions.setNotOnOrAfter(expectedNotOnOfAfter);
assertEquals(expectedOptionalAttributesDOM, conditions);
}
开发者ID:apigee,项目名称:java-opensaml2,代码行数:10,代码来源:ConditionsTest.java
示例11: getConditions
import org.opensaml.saml1.core.Conditions; //导入依赖的package包/类
/** {@inheritDoc} */
public Conditions getConditions() {
return conditions;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:AssertionImpl.java
示例12: setConditions
import org.opensaml.saml1.core.Conditions; //导入依赖的package包/类
/** {@inheritDoc} */
public void setConditions(Conditions conditions) throws IllegalArgumentException {
this.conditions = prepareForAssignment(this.conditions, conditions);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:AssertionImpl.java
示例13: buildObject
import org.opensaml.saml1.core.Conditions; //导入依赖的package包/类
/** {@inheritDoc} */
public Conditions buildObject() {
return buildObject(SAMLConstants.SAML1_NS, Conditions.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:ConditionsBuilder.java
示例14: ConditionsMarshaller
import org.opensaml.saml1.core.Conditions; //导入依赖的package包/类
/**
* Constructor.
*/
public ConditionsMarshaller() {
super(SAMLConstants.SAML1_NS, Conditions.DEFAULT_ELEMENT_LOCAL_NAME);
}
开发者ID:apigee,项目名称:java-opensaml2,代码行数:7,代码来源:ConditionsMarshaller.java
示例15: ConditionsUnmarshaller
import org.opensaml.saml1.core.Conditions; //导入依赖的package包/类
/** Constructor. */
public ConditionsUnmarshaller() {
super(SAMLConstants.SAML1_NS, Conditions.DEFAULT_ELEMENT_LOCAL_NAME);
}
开发者ID:apigee,项目名称:java-opensaml2,代码行数:5,代码来源:ConditionsUnmarshaller.java
示例16: testChildElementsMarshall
import org.opensaml.saml1.core.Conditions; //导入依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsMarshall() {
Conditions conditions = (Conditions) buildXMLObject(qname);
QName arcQname = new QName(SAMLConstants.SAML1_NS, AudienceRestrictionCondition.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
conditions.getConditions().add((AudienceRestrictionCondition) buildXMLObject(arcQname));
conditions.getConditions().add((DoNotCacheCondition) buildXMLObject(new QName(SAMLConstants.SAML1_NS, DoNotCacheCondition.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX)));
// conditions.addCondition(condition);
conditions.getConditions().add((AudienceRestrictionCondition) buildXMLObject(arcQname));
// conditions.addCondition(condition);
//
conditions.getConditions().add((AudienceRestrictionCondition) buildXMLObject(arcQname));
assertEquals(expectedChildElementsDOM, conditions);
}
开发者ID:apigee,项目名称:java-opensaml2,代码行数:20,代码来源:ConditionsTest.java
示例17: createCredentialFromToken
import org.opensaml.saml1.core.Conditions; //导入依赖的package包/类
/**
* createCredentialFromToken converts a SAML 1.1 assertion to a WSFederationCredential.
*
* @param assertion the provided assertion
* @return an equivalent credential.
*/
public static WsFederationCredential createCredentialFromToken(final Assertion assertion) {
final DateTime retrievedOn = new DateTime().withZone(DateTimeZone.UTC);
LOGGER.debug("createCredentialFromToken: retrieved on {}", retrievedOn);
final WsFederationCredential credential = new WsFederationCredential();
credential.setRetrievedOn(retrievedOn);
credential.setId(assertion.getID());
credential.setIssuer(assertion.getIssuer());
credential.setIssuedOn(assertion.getIssueInstant());
final Conditions conditions = assertion.getConditions();
if (conditions != null) {
credential.setNotBefore(conditions.getNotBefore());
credential.setNotOnOrAfter(conditions.getNotOnOrAfter());
credential.setAudience(conditions.getAudienceRestrictionConditions().get(0).getAudiences().get(0).getUri());
}
if (assertion.getAuthenticationStatements() != null && assertion.getAuthenticationStatements().size() > 0) {
credential.setAuthenticationMethod(assertion.getAuthenticationStatements().get(0).getAuthenticationMethod());
}
//retrieve an attributes from the assertion
final HashMap<String, Object> attributes = new HashMap<String, Object>();
for (final Attribute item : assertion.getAttributeStatements().get(0).getAttributes()) {
LOGGER.debug("createCredentialFromToken: processed attribute: {}", item.getAttributeName());
if (item.getAttributeValues().size() == 1) {
attributes.put(item.getAttributeName(), ((XSAny) item.getAttributeValues().get(0)).getTextContent());
} else {
final List<String> itemList = new ArrayList<String>();
for (int i = 0; i < item.getAttributeValues().size(); i++) {
itemList.add(((XSAny) item.getAttributeValues().get(i)).getTextContent());
}
if (!itemList.isEmpty()) {
attributes.put(item.getAttributeName(), itemList);
}
}
}
credential.setAttributes(attributes);
LOGGER.debug("createCredentialFromToken: {}", credential);
return credential;
}
开发者ID:Unicon,项目名称:cas-adfs-integration,代码行数:52,代码来源:WsFederationUtils.java
示例18: testSingleElementMarshall
import org.opensaml.saml1.core.Conditions; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementMarshall() {
Conditions conditions = (Conditions) buildXMLObject(qname);
assertEquals(expectedDOM, conditions);
}
开发者ID:apigee,项目名称:java-opensaml2,代码行数:8,代码来源:ConditionsTest.java
注:本文中的org.opensaml.saml1.core.Conditions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论