private static boolean isRequestQueryString(String queryString) { return RedirectBindingSignatureUtil.getTokenValue(queryString, GeneralConstants.SAML_REQUEST_KEY) != null; }
private static boolean isRequestQueryString(String queryString) { return RedirectBindingSignatureUtil.getTokenValue(queryString, GeneralConstants.SAML_REQUEST_KEY) != null; }
private static boolean isRequestQueryString(String queryString) { return RedirectBindingSignatureUtil.getTokenValue(queryString, GeneralConstants.SAML_REQUEST_KEY) != null; }
private static boolean isRequestQueryString(String queryString) { return RedirectBindingSignatureUtil.getTokenValue(queryString, GeneralConstants.SAML_REQUEST_KEY) != null; }
private static boolean isRequestQueryString(String queryString) { return RedirectBindingSignatureUtil.getTokenValue(queryString, GeneralConstants.SAML_REQUEST_KEY) != null; }
/** * From the query string that contains key/value pairs, get the value of a key * <b>Note:</b> if the token is null, a null value is returned * @param queryString * @param token * @return */ public static String getTokenValue(String queryString, String token) { return getTokenValue(getToken(queryString, token)); }
/** * From the query string that contains key/value pairs, get the value of a key * <b>Note:</b> if the token is null, a null value is returned * @param queryString * @param token * @return */ public static String getTokenValue(String queryString, String token) { return getTokenValue(getToken(queryString, token)); }
/** * From the query string that contains key/value pairs, get the value of a key <b>Note:</b> if the token is null, a null * value is returned * * @param queryString * @param token * @return */ public static String getTokenValue(String queryString, String token) { return getTokenValue(getToken(queryString, token)); }
/** * Get the signature value from the url * @param signedURL * @return * @throws IOException */ public static byte[] getSignatureValueFromSignedURL(String signedURL) throws IOException { String sigValueTokenValue = getTokenValue(signedURL, GeneralConstants.SAML_SIGNATURE_REQUEST_KEY); if (sigValueTokenValue == null) throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "Signature Token is not present"); return RedirectBindingUtil.urlBase64Decode(sigValueTokenValue); }
/** * From the query string that contains key/value pairs, get the value of a key <b>Note:</b> if the token is null, a * null * value is returned * * @param queryString * @param token * * @return */ public static String getTokenValue(String queryString, String token) { return getTokenValue(getToken(queryString, token)); }
/** * Get the signature value from the url * @param signedURL * @return * @throws IOException */ public static byte[] getSignatureValueFromSignedURL(String signedURL) throws IOException { String sigValueTokenValue = getTokenValue(signedURL, GeneralConstants.SAML_SIGNATURE_REQUEST_KEY); if (sigValueTokenValue == null) throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "Signature Token is not present"); return RedirectBindingUtil.urlBase64Decode(sigValueTokenValue); }
/** * From the query string that contains key/value pairs, get the value of a key <b>Note:</b> if the token is null, a * null * value is returned * * @param queryString * @param token * * @return */ public static String getTokenValue(String queryString, String token) { return getTokenValue(getToken(queryString, token)); }
/** * Get the signature value from the url * * @param signedURL * @return * @throws IOException */ public static byte[] getSignatureValueFromSignedURL(String signedURL) throws IOException { String sigValueTokenValue = getTokenValue(signedURL, GeneralConstants.SAML_SIGNATURE_REQUEST_KEY); if (sigValueTokenValue == null) throw new IllegalStateException(logger.samlHandlerSignatureNotPresentError()); return RedirectBindingUtil.urlBase64Decode(sigValueTokenValue); }
public static boolean validateSignature(String queryString, PublicKey validatingKey, byte[] sigValue) throws UnsupportedEncodingException, GeneralSecurityException { // Construct the url again StringBuilder sb = new StringBuilder(); if (isRequestQueryString(queryString)) { addParameter(sb, GeneralConstants.SAML_REQUEST_KEY, RedirectBindingSignatureUtil.getTokenValue(queryString, GeneralConstants.SAML_REQUEST_KEY)); } else { addParameter(sb, GeneralConstants.SAML_RESPONSE_KEY, RedirectBindingSignatureUtil.getTokenValue(queryString, GeneralConstants.SAML_RESPONSE_KEY)); } String relayStateFromURL = RedirectBindingSignatureUtil.getTokenValue(queryString, GeneralConstants.RELAY_STATE); if (isNotNull(relayStateFromURL)) { addParameter(sb, GeneralConstants.RELAY_STATE, relayStateFromURL); } addParameter(sb, GeneralConstants.SAML_SIG_ALG_REQUEST_KEY, RedirectBindingSignatureUtil.getTokenValue(queryString, GeneralConstants.SAML_SIG_ALG_REQUEST_KEY)); return SignatureUtil.validate(sb.toString().getBytes("UTF-8"), sigValue, validatingKey); }
/** * Get the signature value from the url * * @param signedURL * * @return * * @throws IOException */ public static byte[] getSignatureValueFromSignedURL(String signedURL) throws IOException { String sigValueTokenValue = getTokenValue(signedURL, GeneralConstants.SAML_SIGNATURE_REQUEST_KEY); if (sigValueTokenValue == null) throw new IllegalStateException(logger.samlHandlerSignatureNotPresentError()); return RedirectBindingUtil.urlBase64Decode(sigValueTokenValue); }
/** * Get the signature value from the url * * @param signedURL * * @return * * @throws IOException */ public static byte[] getSignatureValueFromSignedURL(String signedURL) throws IOException { String sigValueTokenValue = getTokenValue(signedURL, GeneralConstants.SAML_SIGNATURE_REQUEST_KEY); if (sigValueTokenValue == null) throw new IllegalStateException(logger.samlHandlerSignatureNotPresentError()); return RedirectBindingUtil.urlBase64Decode(sigValueTokenValue); }
/** * From the SAML Request URL, get the Request object * * @param signedURL * @return * @throws IOException * @throws ParsingException * @throws ProcessingException * @throws ConfigurationException */ public static AuthnRequestType getRequestFromSignedURL(String signedURL) throws ConfigurationException, ProcessingException, ParsingException, IOException { String samlRequestTokenValue = getTokenValue(signedURL, GeneralConstants.SAML_REQUEST_KEY); SAML2Request saml2Request = new SAML2Request(); return saml2Request.getAuthnRequestType(RedirectBindingUtil.urlBase64DeflateDecode(samlRequestTokenValue)); }
/** * From the SAML Request URL, get the Request object * @param signedURL * @return * @throws IOException * @throws ParsingException * @throws ProcessingException * @throws ConfigurationException */ public static AuthnRequestType getRequestFromSignedURL(String signedURL) throws ConfigurationException, ProcessingException, ParsingException, IOException { String samlRequestTokenValue = getTokenValue(signedURL, GeneralConstants.SAML_REQUEST_KEY); SAML2Request saml2Request = new SAML2Request(); return saml2Request.getAuthnRequestType(RedirectBindingUtil.urlBase64DeflateDecode(samlRequestTokenValue)); }
/** * From the SAML Request URL, get the Request object * * @param signedURL * * @return * * @throws IOException * @throws ParsingException * @throws ProcessingException * @throws ConfigurationException */ public static AuthnRequestType getRequestFromSignedURL(String signedURL) throws ConfigurationException, ProcessingException, ParsingException, IOException { String samlRequestTokenValue = getTokenValue(signedURL, GeneralConstants.SAML_REQUEST_KEY); SAML2Request saml2Request = new SAML2Request(); return saml2Request.getAuthnRequestType(RedirectBindingUtil.urlBase64DeflateDecode(samlRequestTokenValue)); }
/** * From the SAML Request URL, get the Request object * @param signedURL * @return * @throws IOException * @throws ParsingException * @throws ProcessingException * @throws ConfigurationException */ public static AuthnRequestType getRequestFromSignedURL(String signedURL) throws ConfigurationException, ProcessingException, ParsingException, IOException { String samlRequestTokenValue = getTokenValue(signedURL, GeneralConstants.SAML_REQUEST_KEY); SAML2Request saml2Request = new SAML2Request(); return saml2Request.getAuthnRequestType(RedirectBindingUtil.urlBase64DeflateDecode(samlRequestTokenValue)); }