Search in sources :

Example 1 with AudienceRestrictionCondition

use of org.opensaml.saml.saml1.core.AudienceRestrictionCondition in project cas by apereo.

the class Saml10ObjectBuilder method newConditions.

/**
     * New conditions element.
     *
     * @param issuedAt the issued at
     * @param audienceUri the service id
     * @param issueLength the issue length
     * @return the conditions
     */
public Conditions newConditions(final ZonedDateTime issuedAt, final String audienceUri, final long issueLength) {
    final Conditions conditions = newSamlObject(Conditions.class);
    conditions.setNotBefore(DateTimeUtils.dateTimeOf(issuedAt));
    conditions.setNotOnOrAfter(DateTimeUtils.dateTimeOf(issuedAt.plus(issueLength, ChronoUnit.MILLIS)));
    final AudienceRestrictionCondition audienceRestriction = newSamlObject(AudienceRestrictionCondition.class);
    final Audience audience = newSamlObject(Audience.class);
    audience.setUri(audienceUri);
    audienceRestriction.getAudiences().add(audience);
    conditions.getAudienceRestrictionConditions().add(audienceRestriction);
    return conditions;
}
Also used : Audience(org.opensaml.saml.saml1.core.Audience) AudienceRestrictionCondition(org.opensaml.saml.saml1.core.AudienceRestrictionCondition) Conditions(org.opensaml.saml.saml1.core.Conditions)

Aggregations

Audience (org.opensaml.saml.saml1.core.Audience)1 AudienceRestrictionCondition (org.opensaml.saml.saml1.core.AudienceRestrictionCondition)1 Conditions (org.opensaml.saml.saml1.core.Conditions)1