SAMLUtil { public static boolean isDateTimeSkewValid(int skewInSeconds, DateTime time) { return isDateTimeSkewValid(skewInSeconds, 0, time); }  static String getBindingForEndpoint(Endpoint endpoint); static SingleLogoutService getLogoutServiceForBinding(SSODescriptor descriptor, String binding); static String getLogoutBinding(IDPSSODescriptor idp, SPSSODescriptor sp); static IDPSSODescriptor getIDPSSODescriptor(EntityDescriptor idpEntityDescriptor); static AssertionConsumerService getConsumerService(SPSSODescriptor ssoDescriptor, Integer index); static ArtifactResolutionService getArtifactResolutionService(IDPSSODescriptor idpssoDescriptor, int endpointIndex); static boolean processFilter(String filterName, HttpServletRequest request); static boolean compare(byte[] hashID, String entityId); static void verifyAlias(String alias, String entityId); static List<String> getBase64EncodeCertificates(KeyInfo keyInfo); static List<String> getBase64EncodedCertificates(X509Data x509Data); static boolean isECPRequest(HttpServletRequest request); static T getEndpoint(List<T> endpoints, String messageBinding, InTransport inTransport); static T getEndpoint(List<T> endpoints, String messageBinding, InTransport inTransport, URIComparator uriComparator); static IDPSSODescriptor getIDPDescriptor(MetadataManager metadata, String idpId); static Element marshallMessage(XMLObject message); @SuppressWarnings("unchecked") static Element marshallAndSignMessage(SignableXMLObject signableMessage, Credential signingCredential, String signingAlgorithm, String digestMethodAlgorithm, String keyInfoGenerator); static boolean isDateTimeSkewValid(int skewInSeconds, DateTime time); static boolean isDateTimeSkewValid(int skewInSeconds, long expiryInSeconds, DateTime time); static String getNCNameString(String value); static HostnameVerifier getHostnameVerifier(String hostnameVerificationType); static String getMetadataAsString(MetadataManager metadataManager, KeyManager keyManager, EntityDescriptor descriptor, ExtendedMetadata extendedMetadata);  }
@Test public void isDateTimeSkewShouldReturnTrueForMaxIntegerForwardInterval() { assertTrue(SAMLUtil.isDateTimeSkewValid(60, Integer.MAX_VALUE, new DateTime())); }
@Test public void isDateTimeSkewShouldReturnTrueForZeroForwardInterval() { assertTrue(SAMLUtil.isDateTimeSkewValid(60, 0, new DateTime())); }
@Test(expected = IllegalArgumentException.class) public void isDateTimeSkewShouldThrowErrorForForwardIntervalHigherThanInteger() { SAMLUtil.isDateTimeSkewValid(60, Integer.MAX_VALUE+1L, new DateTime()); }
@Test(expected = IllegalArgumentException.class) public void isDateTimeSkewShouldThrowErrorForForwardIntervalLessThanZero() { SAMLUtil.isDateTimeSkewValid(60, -1, new DateTime()); }