Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Rework session management, introduce Redis for session storing. #17

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,6 @@
<artifactId>htmlcleaner</artifactId>
<version>2.21</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down Expand Up @@ -212,7 +207,6 @@
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.0.7.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand All @@ -226,5 +220,14 @@
<version>1.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
<version>5.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>com.github.kstyrc</groupId>
<artifactId>embedded-redis</artifactId>
<version>0.6</version>
</dependency> </dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public AuthnResult authenticate(AuthnSession session, HttpServletRequest request
if (request != null) {
session.updateIncomingCookies(request);
}
setupSessionCookies(session, response);

AuthnResult result;
switch (maybeForceAuthnState(session)) {
Expand Down Expand Up @@ -639,9 +640,6 @@ private void renderUniversalLoginForm(AuthnSession session, HttpServletRequest r

logger.info(session.logMessage("Rendering Universal Login Form."));
gsaLogger.log(session.getRequestId(), "Rendering Universal Login Form.");
if (null == SessionUtil.findGsaSessionId(request)) {
addAuthnSessionCookie(session, response);
}
updateOutgoingCookies(session, response);
PrintWriter writer = ServletBase.initNormalResponse(response);
writer.print(session.getUniversalLoginForm()
Expand All @@ -651,6 +649,11 @@ private void renderUniversalLoginForm(AuthnSession session, HttpServletRequest r
writer.close();
}

public void setupSessionCookies(AuthnSession session,
HttpServletResponse response) {
addAuthnSessionCookie(session, response);
}

private void addAuthnSessionCookie(AuthnSession session, HttpServletResponse response) {
SessionView view = session.getSnapshot().getView();
CookieStore outgoingCookies = GCookie.makeStore();
Expand Down
Loading