/** * 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 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 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()); }
/** * 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()); }