Skip to content

Commit 58dd3f8

Browse files
authored
Merge pull request #1608 from ropalka/UNDERTOW-2409
[UNDERTOW-2409] Adjust properly session timeout also in case when GET requests with custom auth mechanisms are used
2 parents ef052c3 + 51ae527 commit 58dd3f8

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

servlet/src/main/java/io/undertow/servlet/handlers/security/ServletFormAuthenticationMechanism.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
package io.undertow.servlet.handlers.security;
2020

2121
import static io.undertow.security.api.SecurityNotification.EventType.AUTHENTICATED;
22-
import static io.undertow.util.Methods.POST;
2322
import static io.undertow.util.StatusCodes.OK;
2423

2524
import io.undertow.security.api.AuthenticationMechanism;
@@ -160,16 +159,14 @@ public ServletFormAuthenticationMechanism(FormParserFactory formParserFactory, S
160159

161160
@Override
162161
public AuthenticationMechanismOutcome authenticate(final HttpServerExchange exchange, final SecurityContext securityContext) {
163-
if (POST.equals(exchange.getRequestMethod())) {
164-
securityContext.registerNotificationReceiver(new NotificationReceiver() {
165-
@Override
166-
public void handleNotification(final SecurityNotification notification) {
167-
if (notification.getEventType() == AUTHENTICATED) {
168-
getAndInitializeSession(exchange, false);
169-
}
162+
securityContext.registerNotificationReceiver(new NotificationReceiver() {
163+
@Override
164+
public void handleNotification(final SecurityNotification notification) {
165+
if (notification.getEventType() == AUTHENTICATED) {
166+
getAndInitializeSession(exchange, false);
170167
}
171-
});
172-
}
168+
}
169+
});
173170
return super.authenticate(exchange, securityContext);
174171
}
175172

0 commit comments

Comments
 (0)