29 |
29 |
|
30 |
30 |
try {
|
31 |
31 |
|
32 |
|
Cookie jwt = new Cookie("XCsrfToken", JWTGenerator.generateToken(authOIDC, "my-very-secret"));
|
33 |
|
// Cookie openAIREUser = new Cookie("openAIREUser", new Gson().toJson(JWTGenerator.generateJsonToken(authOIDC)));
|
|
32 |
// Cookie jwt = new Cookie("XCsrfToken", JWTGenerator.generateToken(authOIDC, "my-very-secret"));
|
|
33 |
Cookie openAIREUser = new Cookie("openAIREUser", new Gson().toJson(JWTGenerator.generateJsonToken(authOIDC)));
|
34 |
34 |
Cookie accessToken = new Cookie("AccessToken", authOIDC.getAccessTokenValue());
|
35 |
35 |
|
36 |
36 |
// Expire the cookies in four hours (4 * 3600)
|
37 |
|
jwt.setMaxAge(14400);
|
38 |
|
// openAIREUser.setMaxAge(14400);
|
|
37 |
// jwt.setMaxAge(14400);
|
|
38 |
openAIREUser.setMaxAge(14400);
|
39 |
39 |
accessToken.setMaxAge(14400);
|
40 |
40 |
|
41 |
41 |
//TODO DELETE LOG
|
42 |
42 |
logger.info("\n////////////////////////////////////////////////////////////////////////////////////////////////\n");
|
43 |
|
logger.info("jwt: " + JWTGenerator.generateToken(authOIDC, "my-very-secret"));
|
|
43 |
// logger.info("jwt: " + JWTGenerator.generateToken(authOIDC, "my-very-secret"));
|
44 |
44 |
logger.info("access token: " + authOIDC.getAccessTokenValue());
|
45 |
45 |
logger.info("openAIREUser: " + JWTGenerator.generateJsonToken(authOIDC));
|
46 |
46 |
logger.info("\n////////////////////////////////////////////////////////////////////////////////////////////////\n");
|
... | ... | |
51 |
51 |
// logger.info("\n////////////////////////////////////////////////////////////////////////////////////////////////\n");
|
52 |
52 |
|
53 |
53 |
|
54 |
|
jwt.setPath(frontPath);
|
55 |
|
// openAIREUser.setPath(frontPath);
|
|
54 |
// jwt.setPath(frontPath);
|
|
55 |
openAIREUser.setPath(frontPath);
|
56 |
56 |
accessToken.setPath(frontPath);
|
57 |
57 |
|
58 |
58 |
if (frontDomain!=null) {
|
59 |
|
jwt.setDomain(frontDomain);
|
60 |
|
// openAIREUser.setDomain(frontDomain);
|
|
59 |
// jwt.setDomain(frontDomain);
|
|
60 |
openAIREUser.setDomain(frontDomain);
|
61 |
61 |
accessToken.setDomain(frontDomain);
|
62 |
62 |
}
|
63 |
63 |
|
64 |
|
response.addCookie(jwt);
|
65 |
|
// response.addCookie(openAIREUser);
|
|
64 |
// response.addCookie(jwt);
|
|
65 |
response.addCookie(openAIREUser);
|
66 |
66 |
response.addCookie(accessToken);
|
67 |
67 |
response.sendRedirect(frontEndURI);
|
68 |
68 |
|
Change SESSION to openAIRESession for redis Add openAIREUser and Remove Jwt from cookie