@Override public SignatureValidationException samlHandlerSignatureValidationFailed() { return new SignatureValidationException(ErrorCodes.INVALID_DIGITAL_SIGNATURE + "Signature Validation Failed"); }
@Override public IssueInstantMissingException samlIssueInstantMissingError() { return new IssueInstantMissingException(ErrorCodes.NULL_ISSUE_INSTANT); }
@Override public IssuerNotTrustedException samlIssuerNotTrustedException(Throwable t) { return new IssuerNotTrustedException(t); }
/** * <p> * Add validity conditions to the SAML2 Assertion * </p> * <p> * There is no clock skew added. * * @see {{@link #createTimedConditions(AssertionType, long, long)} * </p> * @param assertion * @param durationInMilis * @throws ConfigurationException * @throws IssueInstantMissingException */ public static void createTimedConditions(AssertionType assertion, long durationInMilis) throws ConfigurationException, IssueInstantMissingException { XMLGregorianCalendar issueInstant = assertion.getIssueInstant(); if (issueInstant == null) throw new IssueInstantMissingException(ErrorCodes.NULL_ISSUE_INSTANT); XMLGregorianCalendar assertionValidityLength = XMLTimeUtil.add(issueInstant, durationInMilis); ConditionsType conditionsType = new ConditionsType(); conditionsType.setNotBefore(issueInstant); conditionsType.setNotOnOrAfter(assertionValidityLength); assertion.setConditions(conditionsType); }
@Override public IssuerNotTrustedException samlIssuerNotTrustedError(String issuer) { return new IssuerNotTrustedException("Issuer not Trusted by the IDP: " + issuer); }
private ProcessingException constructSignatureException() { SignatureValidationException sv = new SignatureValidationException(ErrorCodes.INVALID_DIGITAL_SIGNATURE + "Signature Validation Failed"); return new ProcessingException(sv); } }
/** * <p> * Add validity conditions to the SAML2 Assertion * </p> * <p> * There is no clock skew added. * @see {{@link #createTimedConditions(AssertionType, long, long)} * </p> * @param assertion * @param durationInMilis * @throws ConfigurationException * @throws IssueInstantMissingException */ public static void createTimedConditions(AssertionType assertion, long durationInMilis) throws ConfigurationException, IssueInstantMissingException { XMLGregorianCalendar issueInstant = assertion.getIssueInstant(); if (issueInstant == null) throw new IssueInstantMissingException(ErrorCodes.NULL_ISSUE_INSTANT); XMLGregorianCalendar assertionValidityLength = XMLTimeUtil.add(issueInstant, durationInMilis); ConditionsType conditionsType = new ConditionsType(); conditionsType.setNotBefore(issueInstant); conditionsType.setNotOnOrAfter(assertionValidityLength); assertion.setConditions(conditionsType); }
protected void isTrusted(String issuer) throws IssuerNotTrustedException { try { URL url = new URL(issuer); String issuerDomain = url.getHost(); TrustType idpTrust = spConfiguration.getTrust(); if (idpTrust != null) { String domainsTrusted = idpTrust.getDomains(); if (domainsTrusted.indexOf(issuerDomain) < 0) throw new IssuerNotTrustedException(issuer); } } catch (Exception e) { throw new IssuerNotTrustedException(e.getLocalizedMessage(), e); } }
private ProcessingException constructSignatureException() { SignatureValidationException sv = new SignatureValidationException(ErrorCodes.INVALID_DIGITAL_SIGNATURE + "Signature Validation Failed"); return new ProcessingException(sv); } }
/** * <p> * Add validity conditions to the SAML2 Assertion * </p> * <p> * There is no clock skew added. * @see {{@link #createTimedConditions(AssertionType, long, long)} * </p> * @param assertion * @param durationInMilis * @throws ConfigurationException * @throws IssueInstantMissingException */ public static void createTimedConditions(AssertionType assertion, long durationInMilis) throws ConfigurationException, IssueInstantMissingException { XMLGregorianCalendar issueInstant = assertion.getIssueInstant(); if (issueInstant == null) throw new IssueInstantMissingException(ErrorCodes.NULL_ISSUE_INSTANT); XMLGregorianCalendar assertionValidityLength = XMLTimeUtil.add(issueInstant, durationInMilis); ConditionsType conditionsType = new ConditionsType(); conditionsType.setNotBefore(issueInstant); conditionsType.setNotOnOrAfter(assertionValidityLength); assertion.setConditions(conditionsType); }
protected void isTrusted(String issuer) throws IssuerNotTrustedException { try { URL url = new URL(issuer); String issuerDomain = url.getHost(); TrustType idpTrust = spConfiguration.getTrust(); if (idpTrust != null) { String domainsTrusted = idpTrust.getDomains(); if (domainsTrusted.indexOf(issuerDomain) < 0) throw new IssuerNotTrustedException(issuer); } } catch (Exception e) { throw new IssuerNotTrustedException(e.getLocalizedMessage(), e); } }
/** * Add validity conditions to the SAML2 Assertion * * @param assertion * @param durationInMilis * @throws ConfigurationException * @throws IssueInstantMissingException */ public static void createSAML11TimedConditions(SAML11AssertionType assertion, long durationInMilis, long clockSkew) throws ConfigurationException, IssueInstantMissingException { XMLGregorianCalendar issueInstant = assertion.getIssueInstant(); if (issueInstant == null) throw new IssueInstantMissingException(ErrorCodes.NULL_ISSUE_INSTANT); XMLGregorianCalendar assertionValidityLength = XMLTimeUtil.add(issueInstant, durationInMilis + clockSkew); SAML11ConditionsType conditionsType = new SAML11ConditionsType(); XMLGregorianCalendar beforeInstant = XMLTimeUtil.subtract(issueInstant, clockSkew); conditionsType.setNotBefore(beforeInstant); conditionsType.setNotOnOrAfter(assertionValidityLength); assertion.setConditions(conditionsType); }
protected void isTrusted(String issuer) throws IssuerNotTrustedException { try { URL url = new URL(issuer); String issuerDomain = url.getHost(); TrustType idpTrust = spConfiguration.getTrust(); if (idpTrust != null) { String domainsTrusted = idpTrust.getDomains(); if (domainsTrusted.indexOf(issuerDomain) < 0) throw new IssuerNotTrustedException(issuer); } } catch (Exception e) { throw new IssuerNotTrustedException(e.getLocalizedMessage(), e); } }
/** * Add validity conditions to the SAML2 Assertion * @param assertion * @param durationInMilis * @throws ConfigurationException * @throws IssueInstantMissingException */ public static void createSAML11TimedConditions(SAML11AssertionType assertion, long durationInMilis, long clockSkew) throws ConfigurationException, IssueInstantMissingException { XMLGregorianCalendar issueInstant = assertion.getIssueInstant(); if (issueInstant == null) throw new IssueInstantMissingException(ErrorCodes.NULL_ISSUE_INSTANT); XMLGregorianCalendar assertionValidityLength = XMLTimeUtil.add(issueInstant, durationInMilis + clockSkew); SAML11ConditionsType conditionsType = new SAML11ConditionsType(); XMLGregorianCalendar beforeInstant = XMLTimeUtil.subtract(issueInstant, clockSkew); conditionsType.setNotBefore(beforeInstant); conditionsType.setNotOnOrAfter(assertionValidityLength); assertion.setConditions(conditionsType); }
throw new IssuerNotTrustedException(issuer); throw new IssuerNotTrustedException(e.getLocalizedMessage(), e);
/** * Add validity conditions to the SAML2 Assertion * @param assertion * @param durationInMilis * @throws ConfigurationException * @throws IssueInstantMissingException */ public static void createTimedConditions(AssertionType assertion, long durationInMilis, long clockSkew) throws ConfigurationException, IssueInstantMissingException { XMLGregorianCalendar issueInstant = assertion.getIssueInstant(); if (issueInstant == null) throw new IssueInstantMissingException(ErrorCodes.NULL_ISSUE_INSTANT); XMLGregorianCalendar assertionValidityLength = XMLTimeUtil.add(issueInstant, durationInMilis + clockSkew); ConditionsType conditionsType = new ConditionsType(); XMLGregorianCalendar beforeInstant = XMLTimeUtil.subtract(issueInstant, clockSkew); conditionsType.setNotBefore(beforeInstant); conditionsType.setNotOnOrAfter(assertionValidityLength); assertion.setConditions(conditionsType); }
throw new IssuerNotTrustedException(issuer); throw new IssuerNotTrustedException(e.getLocalizedMessage(), e);
/** * Add validity conditions to the SAML2 Assertion * @param assertion * @param durationInMilis * @throws ConfigurationException * @throws IssueInstantMissingException */ public static void createTimedConditions(AssertionType assertion, long durationInMilis, long clockSkew) throws ConfigurationException, IssueInstantMissingException { XMLGregorianCalendar issueInstant = assertion.getIssueInstant(); if (issueInstant == null) throw new IssueInstantMissingException(ErrorCodes.NULL_ISSUE_INSTANT); XMLGregorianCalendar assertionValidityLength = XMLTimeUtil.add(issueInstant, durationInMilis + clockSkew); ConditionsType conditionsType = new ConditionsType(); XMLGregorianCalendar beforeInstant = XMLTimeUtil.subtract(issueInstant, clockSkew); conditionsType.setNotBefore(beforeInstant); conditionsType.setNotOnOrAfter(assertionValidityLength); assertion.setConditions(conditionsType); }
throw new IssuerNotTrustedException(ErrorCodes.NULL_VALUE + "IssuerID missing"); issuerURL = new URL(issuerID); } catch (MalformedURLException e1) { throw new IssuerNotTrustedException(e1);
/** * Add validity conditions to the SAML2 Assertion * @param assertion * @param durationInMilis * @throws ConfigurationException * @throws IssueInstantMissingException */ public static void createSAML11TimedConditions(SAML11AssertionType assertion, long durationInMilis, long clockSkew) throws ConfigurationException, IssueInstantMissingException { XMLGregorianCalendar issueInstant = assertion.getIssueInstant(); if (issueInstant == null) throw new IssueInstantMissingException(ErrorCodes.NULL_ISSUE_INSTANT); XMLGregorianCalendar assertionValidityLength = XMLTimeUtil.add(issueInstant, durationInMilis + clockSkew); SAML11ConditionsType conditionsType = new SAML11ConditionsType(); XMLGregorianCalendar beforeInstant = XMLTimeUtil.subtract(issueInstant, clockSkew); conditionsType.setNotBefore(beforeInstant); conditionsType.setNotOnOrAfter(assertionValidityLength); assertion.setConditions(conditionsType); }