Skip to content

Commit

Permalink
[UNDERTOW-2409] Adjust properly session timeout also in case when GET…
Browse files Browse the repository at this point in the history
… requests with custom auth mechanisms are used
  • Loading branch information
aogburn committed Jun 18, 2024
1 parent 04234f4 commit a02484b
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package io.undertow.servlet.handlers.security;

import static io.undertow.security.api.SecurityNotification.EventType.AUTHENTICATED;
import static io.undertow.util.Methods.POST;
import static io.undertow.util.StatusCodes.OK;

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

@Override
public AuthenticationMechanismOutcome authenticate(final HttpServerExchange exchange, final SecurityContext securityContext) {
if (POST.equals(exchange.getRequestMethod())) {
securityContext.registerNotificationReceiver(new NotificationReceiver() {
@Override
public void handleNotification(final SecurityNotification notification) {
if (notification.getEventType() == AUTHENTICATED) {
getAndInitializeSession(exchange, false);
}
securityContext.registerNotificationReceiver(new NotificationReceiver() {
@Override
public void handleNotification(final SecurityNotification notification) {
if (notification.getEventType() == AUTHENTICATED) {
getAndInitializeSession(exchange, false);
}
});
}
}
});
return super.authenticate(exchange, securityContext);
}

Expand Down

0 comments on commit a02484b

Please sign in to comment.