From ee6df1701b1ca03ffad39c54de252b3cb8319cf7 Mon Sep 17 00:00:00 2001 From: James <675056+OrangeDog@users.noreply.github.com> Date: Fri, 31 Jan 2020 10:56:56 +0000 Subject: [PATCH] Polish SessionManagementConfigurer --- .../SessionManagementConfigurer.java | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurer.java b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurer.java index 68db26c296..e53be5d8bb 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurer.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurer.java @@ -557,17 +557,13 @@ public final class SessionManagementConfigurer> if (this.invalidSessionStrategy != null) { return this.invalidSessionStrategy; } - if (this.invalidSessionUrl != null) { - this.invalidSessionStrategy = new SimpleRedirectInvalidSessionStrategy( - this.invalidSessionUrl); - } + if (this.invalidSessionUrl == null) { return null; } - if (this.invalidSessionStrategy == null) { - this.invalidSessionStrategy = new SimpleRedirectInvalidSessionStrategy( + + this.invalidSessionStrategy = new SimpleRedirectInvalidSessionStrategy( this.invalidSessionUrl); - } return this.invalidSessionStrategy; } @@ -580,10 +576,8 @@ public final class SessionManagementConfigurer> return null; } - if (this.expiredSessionStrategy == null) { - this.expiredSessionStrategy = new SimpleRedirectSessionInformationExpiredStrategy( - this.expiredUrl); - } + this.expiredSessionStrategy = new SimpleRedirectSessionInformationExpiredStrategy( + this.expiredUrl); return this.expiredSessionStrategy; } @@ -596,10 +590,8 @@ public final class SessionManagementConfigurer> return null; } - if (this.sessionAuthenticationFailureHandler == null) { - this.sessionAuthenticationFailureHandler = new SimpleUrlAuthenticationFailureHandler( - this.sessionAuthenticationErrorUrl); - } + this.sessionAuthenticationFailureHandler = new SimpleUrlAuthenticationFailureHandler( + this.sessionAuthenticationErrorUrl); return this.sessionAuthenticationFailureHandler; }