Package org.opensaml.saml.saml2.common

# Class SAML2Support

java.lang.Object
org.opensaml.saml.saml2.common.SAML2Support

public final class SAML2Support extends Object
Utility class for common SAML 2 operations.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`private`
`SAML2Support()`
Private constructor to disallow instantiation.

## Method Summary

Modifier and Type
Method
Description
`static Instant`
`getEarliestExpiration(XMLObject xmlObject)`
Gets the earliest expiration instant for a XMLObject.
`static Instant`
`getEarliestExpiration(XMLObject xmlObject, Instant candidateTime, Instant now)`
Gets the earliest expiration instant within a metadata tree.
`static Instant`
`getEarliestExpirationFromCacheable(CacheableSAMLObject cacheableObject, Instant candidateTime, Instant now)`
Gets the earliest effective expiration instant of the specified cacheable SAML object and the specified candidate time.
`static Instant`
`getEarliestExpirationFromTimeBound(TimeBoundSAMLObject timeBoundObject, Instant candidateTime)`
Gets the earliest effective expiration instant of the specified time-bound SAML object and the specified candidate time.
`static boolean`
`isValid(XMLObject xmlObject)`
Checks to see if the given XMLObject is still valid.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SAML2Support

private SAML2Support()
Private constructor to disallow instantiation.

## Method Details

### isValid

public static boolean isValid(@Nonnull XMLObject xmlObject)
Checks to see if the given XMLObject is still valid. An XMLObject is valid if, and only if, itself and every ancestral `TimeBoundSAMLObject` is valid.

Parameters:
  `xmlObject` - the XML object tree to check
Returns:
  true of the tree is valid, false if not

### getEarliestExpiration

@Nullable public static Instant getEarliestExpiration(@Nullable XMLObject xmlObject)
Gets the earliest expiration instant for a XMLObject. This method traverses the tree of SAMLObject rooted at the given object and calculates the earliest expiration as the earliest of the following two items:

- the earliest validUntil time on a `TimeBoundSAMLObject`
- the shortest duration on a `CacheableSAMLObject` added to the current time

Parameters:
  `xmlObject` - the XML object tree from which to get the earliest expiration time
Returns:
  the earliest expiration time

### getEarliestExpiration

@Nullable public static Instant getEarliestExpiration(@Nullable XMLObject xmlObject, @Nullable Instant candidateTime, @Nonnull Instant now)
Gets the earliest expiration instant within a metadata tree.

Parameters:
  `xmlObject` - the target XMLObject to evaluate
  `candidateTime` - the candidate earliest expiration instant
  `now` - when this method was called
Returns:
  the earliest expiration instant within a metadata tree. May be null if the input candiateTime was null, otherwise will always be non-null.

### getEarliestExpirationFromCacheable

@Nullable public static Instant getEarliestExpirationFromCacheable(@Nonnull CacheableSAMLObject cacheableObject, @Nullable Instant candidateTime, @Nonnull Instant now)
Gets the earliest effective expiration instant of the specified cacheable SAML object and the specified candidate time.

Parameters:
  `cacheableObject` - the target XMLObject to evaluate
  `candidateTime` - the candidate earliest expiration instant
  `now` - when this method was called
Returns:
  the earliest effective expiration instant of the 2 targets. May be null if the input candiateTime was null, otherwise will always be non-null.

### getEarliestExpirationFromTimeBound

@Nullable public static Instant getEarliestExpirationFromTimeBound(@Nonnull TimeBoundSAMLObject timeBoundObject, @Nullable Instant candidateTime)
Gets the earliest effective expiration instant of the specified time-bound SAML object and the specified candidate time.

Parameters:
  `timeBoundObject` - the target XMLObject to evaluate
  `candidateTime` - the earliest expiration instant
Returns:
  the earliest effective expiration instant of the 2 targets. May be null if the input candiateTime was null, otherwise will always be non-null.