added cookie to response in auth filter for request objects

pull/166/merge
Mike Derryberry 2012-08-09 13:08:15 -04:00 committed by Justin Richer
parent f7cfb39777
commit bc216785b8
1 changed files with 5 additions and 3 deletions

View File

@ -87,7 +87,7 @@ public class OIDCSignedRequestFilter extends AbstractOIDCAuthenticationFilter {
public void handleAuthorizationRequest(HttpServletRequest request, HttpServletResponse response,
OIDCServerConfiguration serverConfiguration) throws IOException {
Jwt jwt = createAndSignRequestJwt(request, serverConfiguration);
Jwt jwt = createAndSignRequestJwt(request, response, serverConfiguration);
Map<String, String> urlVariables = new HashMap<String, String>();
@ -100,7 +100,7 @@ public class OIDCSignedRequestFilter extends AbstractOIDCAuthenticationFilter {
response.sendRedirect(authRequest);
}
public Jwt createAndSignRequestJwt(HttpServletRequest request, OIDCServerConfiguration serverConfiguration) {
public Jwt createAndSignRequestJwt(HttpServletRequest request, HttpServletResponse response, OIDCServerConfiguration serverConfiguration) {
Jwt jwt = new Jwt();
JwtHeader header = jwt.getHeader();
JwtClaims claims = jwt.getClaims();
@ -117,7 +117,9 @@ public class OIDCSignedRequestFilter extends AbstractOIDCAuthenticationFilter {
//create random nonce
String nonce = new BigInteger(50, new SecureRandom()).toString(16);
Cookie nonceCookie = new Cookie(NONCE_SIGNATURE_COOKIE_NAME, sign(signer, privateKey, nonce.getBytes()));
response.addCookie(nonceCookie);
claims.setClaim("nonce", nonceCookie);
try {