Author: dehort
Date: 2012-07-10 15:41:13 -0400 (Tue, 10 Jul 2012)
New Revision: 1571
Modified:
product/branches/2.0.2_JBPAPP-9307/picketlink-core/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPRedirectSignatureFormAuthenticator.java
Log:
Backporting SPRedirectSignatureFormAuthenticator fix to 2.0.2 [JBPAPP-9307]
Modified:
product/branches/2.0.2_JBPAPP-9307/picketlink-core/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPRedirectSignatureFormAuthenticator.java
===================================================================
---
product/branches/2.0.2_JBPAPP-9307/picketlink-core/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPRedirectSignatureFormAuthenticator.java 2012-07-10
19:38:10 UTC (rev 1570)
+++
product/branches/2.0.2_JBPAPP-9307/picketlink-core/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPRedirectSignatureFormAuthenticator.java 2012-07-10
19:41:13 UTC (rev 1571)
@@ -194,8 +194,25 @@
{
//Get the signing key
PrivateKey signingKey = keyManager.getSigningKey();
- String url =
RedirectBindingSignatureUtil.getSAMLRequestURLWithSignature(urlEncodedRequest,
- urlEncodedRelayState, signingKey);
+
+ if (signingKey == null) {
+ log.error("Signing is null. Check your KeyStore configuration.");
+ throw new RuntimeException(ErrorCodes.SIGNING_PROCESS_FAILURE);
+ }
+
+ String url = null;
+
+ if (sendRequest)
+ {
+ url =
RedirectBindingSignatureUtil.getSAMLRequestURLWithSignature(urlEncodedRequest,
urlEncodedRelayState,
+ signingKey);
+ }
+ else
+ {
+ url =
RedirectBindingSignatureUtil.getSAMLResponseURLWithSignature(urlEncodedRequest,
urlEncodedRelayState,
+ signingKey);
+ }
+
return url;
}
catch (Exception e)