Search in sources :

Example 1 with XSDateTimeBuilder

use of org.opensaml.core.xml.schema.impl.XSDateTimeBuilder in project spring-security by spring-projects.

the class OpenSamlAuthenticationProviderTests method attributeStatements.

private List<AttributeStatement> attributeStatements() {
    List<AttributeStatement> attributeStatements = TestOpenSamlObjects.attributeStatements();
    AttributeBuilder attributeBuilder = new AttributeBuilder();
    Attribute registeredDateAttr = attributeBuilder.buildObject();
    registeredDateAttr.setName("registeredDate");
    XSDateTime registeredDate = new XSDateTimeBuilder().buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSDateTime.TYPE_NAME);
    registeredDate.setValue(DateTime.parse("1970-01-01T00:00:00Z"));
    registeredDateAttr.getAttributeValues().add(registeredDate);
    attributeStatements.get(0).getAttributes().add(registeredDateAttr);
    return attributeStatements;
}
Also used : AttributeBuilder(org.opensaml.saml.saml2.core.impl.AttributeBuilder) XSDateTime(org.opensaml.core.xml.schema.XSDateTime) XSDateTimeBuilder(org.opensaml.core.xml.schema.impl.XSDateTimeBuilder) Attribute(org.opensaml.saml.saml2.core.Attribute) EncryptedAttribute(org.opensaml.saml.saml2.core.EncryptedAttribute) AttributeStatement(org.opensaml.saml.saml2.core.AttributeStatement)

Example 2 with XSDateTimeBuilder

use of org.opensaml.core.xml.schema.impl.XSDateTimeBuilder in project spring-security by spring-projects.

the class OpenSaml4AuthenticationProviderTests method attributeStatements.

private List<AttributeStatement> attributeStatements() {
    List<AttributeStatement> attributeStatements = TestOpenSamlObjects.attributeStatements();
    AttributeBuilder attributeBuilder = new AttributeBuilder();
    Attribute registeredDateAttr = attributeBuilder.buildObject();
    registeredDateAttr.setName("registeredDate");
    XSDateTime registeredDate = new XSDateTimeBuilder().buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSDateTime.TYPE_NAME);
    registeredDate.setValue(Instant.parse("1970-01-01T00:00:00Z"));
    registeredDateAttr.getAttributeValues().add(registeredDate);
    attributeStatements.iterator().next().getAttributes().add(registeredDateAttr);
    return attributeStatements;
}
Also used : AttributeBuilder(org.opensaml.saml.saml2.core.impl.AttributeBuilder) XSDateTime(org.opensaml.core.xml.schema.XSDateTime) XSDateTimeBuilder(org.opensaml.core.xml.schema.impl.XSDateTimeBuilder) Attribute(org.opensaml.saml.saml2.core.Attribute) EncryptedAttribute(org.opensaml.saml.saml2.core.EncryptedAttribute) AttributeStatement(org.opensaml.saml.saml2.core.AttributeStatement)

Aggregations

XSDateTime (org.opensaml.core.xml.schema.XSDateTime)2 XSDateTimeBuilder (org.opensaml.core.xml.schema.impl.XSDateTimeBuilder)2 Attribute (org.opensaml.saml.saml2.core.Attribute)2 AttributeStatement (org.opensaml.saml.saml2.core.AttributeStatement)2 EncryptedAttribute (org.opensaml.saml.saml2.core.EncryptedAttribute)2 AttributeBuilder (org.opensaml.saml.saml2.core.impl.AttributeBuilder)2