All Downloads are FREE. Search and download functionalities are using the official Maven repository.

uk.gov.ida.saml.hub.domain.IdaAuthnRequestFromHub Maven / Gradle / Ivy

There is a newer version: 3.4.6-277
Show newest version
package uk.gov.ida.saml.hub.domain;

import org.joda.time.DateTime;
import org.opensaml.saml.saml2.core.AuthnContextComparisonTypeEnumeration;
import uk.gov.ida.saml.core.domain.AuthnContext;
import uk.gov.ida.saml.core.domain.IdaSamlMessage;

import java.net.URI;
import java.util.List;
import java.util.Optional;

public class IdaAuthnRequestFromHub extends IdaSamlMessage {
    private List levelsOfAssurance;
    private Optional forceAuthentication;
    private DateTime sessionExpiryTimestamp;
    private final AuthnContextComparisonTypeEnumeration comparisonType;

    public IdaAuthnRequestFromHub(
            String id,
            String issuer,
            DateTime issueInstant,
            List levelsOfAssurance,
            Optional forceAuthentication,
            DateTime sessionExpiryTimestamp,
            URI idpPostEndpoint,
            AuthnContextComparisonTypeEnumeration comparisonType) {
        super(id, issuer, issueInstant, idpPostEndpoint);
        this.levelsOfAssurance = levelsOfAssurance;
        this.forceAuthentication = forceAuthentication;
        this.sessionExpiryTimestamp = sessionExpiryTimestamp;
        this.comparisonType = comparisonType;
    }

    public static IdaAuthnRequestFromHub createRequestToSendFromHub(
            String id,
            List levelsOfAssurance,
            Optional forceAuthentication,
            DateTime sessionExpiryTimestamp,
            URI idpPostEndpoint,
            AuthnContextComparisonTypeEnumeration comparisonType,
            String hubEntityId) {
        return new IdaAuthnRequestFromHub(id, hubEntityId, DateTime.now(), levelsOfAssurance, forceAuthentication, sessionExpiryTimestamp, idpPostEndpoint, comparisonType);
    }

    public static IdaAuthnRequestFromHub createRequestReceivedFromHub(String id, String issuerId, List levelsOfAssurance, boolean forceAuthentication, DateTime notOnOrAfter, AuthnContextComparisonTypeEnumeration comparisonType) {
        return new IdaAuthnRequestFromHub(id, issuerId, DateTime.now(), levelsOfAssurance, Optional.ofNullable(forceAuthentication), notOnOrAfter, null, comparisonType); // null because it was sent to the consumer of this message
    }

    public Optional getForceAuthentication() {
        return forceAuthentication;
    }

    public DateTime getSessionExpiryTimestamp() {
        return sessionExpiryTimestamp;
    }

    public List getLevelsOfAssurance() {
        return levelsOfAssurance;
    }

    public AuthnContextComparisonTypeEnumeration getComparisonType() {
        return comparisonType;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy