/** * Given an url-encoded saml request and relay state and a private key, compute the url * * @param urlEncodedRequest * @param urlEncodedRelayState * @param signingKey * @return * @throws GeneralSecurityException * @throws IOException */ public static String getSAMLRequestURLWithSignature(String urlEncodedRequest, String urlEncodedRelayState, PrivateKey signingKey) throws IOException, GeneralSecurityException { byte[] sigValue = computeSignature(GeneralConstants.SAML_REQUEST_KEY, urlEncodedRequest, urlEncodedRelayState, signingKey); return getRequestRedirectURLWithSignature(urlEncodedRequest, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Given an url-encoded saml request and relay state and a private key, compute the url * @param urlEncodedRequest * @param urlEncodedRelayState * @param signingKey * @return * @throws GeneralSecurityException * @throws IOException */ public static String getSAMLRequestURLWithSignature(String urlEncodedRequest, String urlEncodedRelayState, PrivateKey signingKey) throws IOException, GeneralSecurityException { byte[] sigValue = computeSignature(GeneralConstants.SAML_REQUEST_KEY, urlEncodedRequest, urlEncodedRelayState, signingKey); return getRequestRedirectURLWithSignature(urlEncodedRequest, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Given an url-encoded saml response and relay state and a private key, compute the url * @param urlEncodedResponse * @param urlEncodedRelayState * @param signingKey * @return * @throws GeneralSecurityException * @throws IOException */ public static String getSAMLResponseURLWithSignature(String urlEncodedResponse, String urlEncodedRelayState, PrivateKey signingKey) throws IOException, GeneralSecurityException { byte[] sigValue = computeSignature(GeneralConstants.SAML_RESPONSE_KEY, urlEncodedResponse, urlEncodedRelayState, signingKey); return getResponseRedirectURLWithSignature(urlEncodedResponse, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Given an url-encoded saml response and relay state and a private key, compute the url * * @param urlEncodedResponse * @param urlEncodedRelayState * @param signingKey * @return * @throws GeneralSecurityException * @throws IOException */ public static String getSAMLResponseURLWithSignature(String urlEncodedResponse, String urlEncodedRelayState, PrivateKey signingKey) throws IOException, GeneralSecurityException { byte[] sigValue = computeSignature(GeneralConstants.SAML_RESPONSE_KEY, urlEncodedResponse, urlEncodedRelayState, signingKey); return getResponseRedirectURLWithSignature(urlEncodedResponse, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Given an url-encoded saml request and relay state and a private key, compute the url * @param urlEncodedRequest * @param urlEncodedRelayState * @param signingKey * @return * @throws GeneralSecurityException * @throws IOException */ public static String getSAMLRequestURLWithSignature(String urlEncodedRequest, String urlEncodedRelayState, PrivateKey signingKey) throws IOException, GeneralSecurityException { byte[] sigValue = computeSignature(GeneralConstants.SAML_REQUEST_KEY, urlEncodedRequest, urlEncodedRelayState, signingKey); return getRequestRedirectURLWithSignature(urlEncodedRequest, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Given an url-encoded saml response and relay state and a private key, compute the url * @param urlEncodedResponse * @param urlEncodedRelayState * @param signingKey * @return * @throws GeneralSecurityException * @throws IOException */ public static String getSAMLResponseURLWithSignature(String urlEncodedResponse, String urlEncodedRelayState, PrivateKey signingKey) throws IOException, GeneralSecurityException { byte[] sigValue = computeSignature(GeneralConstants.SAML_RESPONSE_KEY, urlEncodedResponse, urlEncodedRelayState, signingKey); return getResponseRedirectURLWithSignature(urlEncodedResponse, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Given an url-encoded saml request and relay state and a private key, compute the url * * @param urlEncodedRequest * @param urlEncodedRelayState * @param signingKey * * @return * * @throws GeneralSecurityException * @throws IOException */ public static String getSAMLRequestURLWithSignature(String urlEncodedRequest, String urlEncodedRelayState, PrivateKey signingKey) throws IOException, GeneralSecurityException { byte[] sigValue = computeSignature(GeneralConstants.SAML_REQUEST_KEY, urlEncodedRequest, urlEncodedRelayState, signingKey); return getRequestRedirectURLWithSignature(urlEncodedRequest, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Given an url-encoded saml request and relay state and a private key, compute the url * * @param urlEncodedRequest * @param urlEncodedRelayState * @param signingKey * * @return * * @throws GeneralSecurityException * @throws IOException */ public static String getSAMLRequestURLWithSignature(String urlEncodedRequest, String urlEncodedRelayState, PrivateKey signingKey) throws IOException, GeneralSecurityException { byte[] sigValue = computeSignature(GeneralConstants.SAML_REQUEST_KEY, urlEncodedRequest, urlEncodedRelayState, signingKey); return getRequestRedirectURLWithSignature(urlEncodedRequest, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Given an url-encoded saml response and relay state and a private key, compute the url * * @param urlEncodedResponse * @param urlEncodedRelayState * @param signingKey * * @return * * @throws GeneralSecurityException * @throws IOException */ public static String getSAMLResponseURLWithSignature(String urlEncodedResponse, String urlEncodedRelayState, PrivateKey signingKey) throws IOException, GeneralSecurityException { byte[] sigValue = computeSignature(GeneralConstants.SAML_RESPONSE_KEY, urlEncodedResponse, urlEncodedRelayState, signingKey); return getResponseRedirectURLWithSignature(urlEncodedResponse, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Given an url-encoded saml response and relay state and a private key, compute the url * * @param urlEncodedResponse * @param urlEncodedRelayState * @param signingKey * * @return * * @throws GeneralSecurityException * @throws IOException */ public static String getSAMLResponseURLWithSignature(String urlEncodedResponse, String urlEncodedRelayState, PrivateKey signingKey) throws IOException, GeneralSecurityException { byte[] sigValue = computeSignature(GeneralConstants.SAML_RESPONSE_KEY, urlEncodedResponse, urlEncodedRelayState, signingKey); return getResponseRedirectURLWithSignature(urlEncodedResponse, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Get the URL for the SAML request that contains the signature and signature algorithm * @param authRequest * @param relayState * @param signingKey * @return * @throws SAXException * @throws IOException * @throws GeneralSecurityException */ public static String getSAMLRequestURLWithSignature(AuthnRequestType authRequest, String relayState, PrivateKey signingKey) throws SAXException, IOException, GeneralSecurityException { SAML2Request saml2Request = new SAML2Request(); // Deal with the original request StringWriter sw = new StringWriter(); saml2Request.marshall(authRequest, sw); //URL Encode the Request String urlEncodedRequest = RedirectBindingUtil.deflateBase64URLEncode(sw.toString()); String urlEncodedRelayState = null; if (isNotNull(relayState)) urlEncodedRelayState = URLEncoder.encode(relayState, "UTF-8"); byte[] sigValue = computeSignature(GeneralConstants.SAML_REQUEST_KEY, urlEncodedRequest, urlEncodedRelayState, signingKey); //Now construct the URL return getRequestRedirectURLWithSignature(urlEncodedRequest, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Get the URL for the SAML request that contains the signature and signature algorithm * * @param authRequest * @param relayState * @param signingKey * @return * @throws SAXException * @throws IOException * @throws GeneralSecurityException */ public static String getSAMLRequestURLWithSignature(AuthnRequestType authRequest, String relayState, PrivateKey signingKey) throws SAXException, IOException, GeneralSecurityException { SAML2Request saml2Request = new SAML2Request(); // Deal with the original request StringWriter sw = new StringWriter(); saml2Request.marshall(authRequest, sw); // URL Encode the Request String urlEncodedRequest = RedirectBindingUtil.deflateBase64URLEncode(sw.toString()); String urlEncodedRelayState = null; if (isNotNull(relayState)) urlEncodedRelayState = URLEncoder.encode(relayState, "UTF-8"); byte[] sigValue = computeSignature(GeneralConstants.SAML_REQUEST_KEY, urlEncodedRequest, urlEncodedRelayState, signingKey); // Now construct the URL return getRequestRedirectURLWithSignature(urlEncodedRequest, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Get the URL for the SAML request that contains the signature and signature algorithm * @param authRequest * @param relayState * @param signingKey * @return * @throws SAXException * @throws IOException * @throws GeneralSecurityException */ public static String getSAMLRequestURLWithSignature(AuthnRequestType authRequest, String relayState, PrivateKey signingKey) throws SAXException, IOException, GeneralSecurityException { SAML2Request saml2Request = new SAML2Request(); // Deal with the original request StringWriter sw = new StringWriter(); saml2Request.marshall(authRequest, sw); //URL Encode the Request String urlEncodedRequest = RedirectBindingUtil.deflateBase64URLEncode(sw.toString()); String urlEncodedRelayState = null; if (isNotNull(relayState)) urlEncodedRelayState = URLEncoder.encode(relayState, "UTF-8"); byte[] sigValue = computeSignature(GeneralConstants.SAML_REQUEST_KEY, urlEncodedRequest, urlEncodedRelayState, signingKey); //Now construct the URL return getRequestRedirectURLWithSignature(urlEncodedRequest, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Get the URL for the SAML request that contains the signature and signature algorithm * * @param authRequest * @param relayState * @param signingKey * * @return * * @throws SAXException * @throws IOException * @throws GeneralSecurityException */ public static String getSAMLRequestURLWithSignature(AuthnRequestType authRequest, String relayState, PrivateKey signingKey) throws SAXException, IOException, GeneralSecurityException { SAML2Request saml2Request = new SAML2Request(); // Deal with the original request StringWriter sw = new StringWriter(); saml2Request.marshall(authRequest, sw); // URL Encode the Request String urlEncodedRequest = RedirectBindingUtil.deflateBase64URLEncode(sw.toString()); String urlEncodedRelayState = null; if (isNotNull(relayState)) urlEncodedRelayState = URLEncoder.encode(relayState, "UTF-8"); byte[] sigValue = computeSignature(GeneralConstants.SAML_REQUEST_KEY, urlEncodedRequest, urlEncodedRelayState, signingKey); // Now construct the URL return getRequestRedirectURLWithSignature(urlEncodedRequest, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Get the URL for the SAML request that contains the signature and signature algorithm * * @param authRequest * @param relayState * @param signingKey * * @return * * @throws SAXException * @throws IOException * @throws GeneralSecurityException */ public static String getSAMLRequestURLWithSignature(AuthnRequestType authRequest, String relayState, PrivateKey signingKey) throws SAXException, IOException, GeneralSecurityException { SAML2Request saml2Request = new SAML2Request(); // Deal with the original request StringWriter sw = new StringWriter(); saml2Request.marshall(authRequest, sw); // URL Encode the Request String urlEncodedRequest = RedirectBindingUtil.deflateBase64URLEncode(sw.toString()); String urlEncodedRelayState = null; if (isNotNull(relayState)) urlEncodedRelayState = URLEncoder.encode(relayState, "UTF-8"); byte[] sigValue = computeSignature(GeneralConstants.SAML_REQUEST_KEY, urlEncodedRequest, urlEncodedRelayState, signingKey); // Now construct the URL return getRequestRedirectURLWithSignature(urlEncodedRequest, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Get the URL for the SAML request that contains the signature and signature algorithm * @param responseType * @param relayState * @param signingKey * @return * @throws IOException * @throws GeneralSecurityException */ public static String getSAMLResponseURLWithSignature(ResponseType responseType, String relayState, PrivateKey signingKey) throws IOException, GeneralSecurityException { SAML2Response saml2Response = new SAML2Response(); Document responseDoc = saml2Response.convert(responseType); //URL Encode the Request String responseString = DocumentUtil.getDocumentAsString(responseDoc); String urlEncodedResponse = RedirectBindingUtil.deflateBase64URLEncode(responseString); String urlEncodedRelayState = null; if (isNotNull(relayState)) urlEncodedRelayState = URLEncoder.encode(relayState, "UTF-8"); byte[] sigValue = computeSignature(GeneralConstants.SAML_RESPONSE_KEY, urlEncodedResponse, urlEncodedRelayState, signingKey); //Now construct the URL return getResponseRedirectURLWithSignature(urlEncodedResponse, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Get the URL for the SAML request that contains the signature and signature algorithm * * @param responseType * @param relayState * @param signingKey * @return * @throws IOException * @throws GeneralSecurityException */ public static String getSAMLResponseURLWithSignature(ResponseType responseType, String relayState, PrivateKey signingKey) throws IOException, GeneralSecurityException { SAML2Response saml2Response = new SAML2Response(); Document responseDoc = saml2Response.convert(responseType); // URL Encode the Request String responseString = DocumentUtil.getDocumentAsString(responseDoc); String urlEncodedResponse = RedirectBindingUtil.deflateBase64URLEncode(responseString); String urlEncodedRelayState = null; if (isNotNull(relayState)) urlEncodedRelayState = URLEncoder.encode(relayState, "UTF-8"); byte[] sigValue = computeSignature(GeneralConstants.SAML_RESPONSE_KEY, urlEncodedResponse, urlEncodedRelayState, signingKey); // Now construct the URL return getResponseRedirectURLWithSignature(urlEncodedResponse, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Get the URL for the SAML request that contains the signature and signature algorithm * * @param responseType * @param relayState * @param signingKey * * @return * * @throws IOException * @throws GeneralSecurityException */ public static String getSAMLResponseURLWithSignature(ResponseType responseType, String relayState, PrivateKey signingKey) throws IOException, GeneralSecurityException { SAML2Response saml2Response = new SAML2Response(); Document responseDoc = saml2Response.convert(responseType); // URL Encode the Request String responseString = DocumentUtil.getDocumentAsString(responseDoc); String urlEncodedResponse = RedirectBindingUtil.deflateBase64URLEncode(responseString); String urlEncodedRelayState = null; if (isNotNull(relayState)) urlEncodedRelayState = URLEncoder.encode(relayState, "UTF-8"); byte[] sigValue = computeSignature(GeneralConstants.SAML_RESPONSE_KEY, urlEncodedResponse, urlEncodedRelayState, signingKey); // Now construct the URL return getResponseRedirectURLWithSignature(urlEncodedResponse, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Get the URL for the SAML request that contains the signature and signature algorithm * @param responseType * @param relayState * @param signingKey * @return * @throws IOException * @throws GeneralSecurityException */ public static String getSAMLResponseURLWithSignature(ResponseType responseType, String relayState, PrivateKey signingKey) throws IOException, GeneralSecurityException { SAML2Response saml2Response = new SAML2Response(); Document responseDoc = saml2Response.convert(responseType); //URL Encode the Request String responseString = DocumentUtil.getDocumentAsString(responseDoc); String urlEncodedResponse = RedirectBindingUtil.deflateBase64URLEncode(responseString); String urlEncodedRelayState = null; if (isNotNull(relayState)) urlEncodedRelayState = URLEncoder.encode(relayState, "UTF-8"); byte[] sigValue = computeSignature(GeneralConstants.SAML_RESPONSE_KEY, urlEncodedResponse, urlEncodedRelayState, signingKey); //Now construct the URL return getResponseRedirectURLWithSignature(urlEncodedResponse, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }
/** * Get the URL for the SAML request that contains the signature and signature algorithm * * @param responseType * @param relayState * @param signingKey * * @return * * @throws IOException * @throws GeneralSecurityException */ public static String getSAMLResponseURLWithSignature(ResponseType responseType, String relayState, PrivateKey signingKey) throws IOException, GeneralSecurityException { SAML2Response saml2Response = new SAML2Response(); Document responseDoc = saml2Response.convert(responseType); // URL Encode the Request String responseString = DocumentUtil.getDocumentAsString(responseDoc); String urlEncodedResponse = RedirectBindingUtil.deflateBase64URLEncode(responseString); String urlEncodedRelayState = null; if (isNotNull(relayState)) urlEncodedRelayState = URLEncoder.encode(relayState, "UTF-8"); byte[] sigValue = computeSignature(GeneralConstants.SAML_RESPONSE_KEY, urlEncodedResponse, urlEncodedRelayState, signingKey); // Now construct the URL return getResponseRedirectURLWithSignature(urlEncodedResponse, urlEncodedRelayState, sigValue, signingKey.getAlgorithm()); }