157
157
import org .springframework .security .web .server .authentication .logout .ServerLogoutHandler ;
158
158
import org .springframework .security .web .server .authentication .logout .ServerLogoutSuccessHandler ;
159
159
import org .springframework .security .web .server .authentication .ott .GenerateOneTimeTokenWebFilter ;
160
- import org .springframework .security .web .server .authentication .ott .ServerGeneratedOneTimeTokenHandler ;
161
160
import org .springframework .security .web .server .authentication .ott .ServerOneTimeTokenAuthenticationConverter ;
161
+ import org .springframework .security .web .server .authentication .ott .ServerOneTimeTokenGenerationSuccessHandler ;
162
162
import org .springframework .security .web .server .authorization .AuthorizationContext ;
163
163
import org .springframework .security .web .server .authorization .AuthorizationWebFilter ;
164
164
import org .springframework .security .web .server .authorization .DelegatingReactiveAuthorizationManager ;
@@ -5922,7 +5922,7 @@ public final class OneTimeTokenLoginSpec {
5922
5922
5923
5923
private ReactiveAuthenticationManager authenticationManager ;
5924
5924
5925
- private ReactiveOneTimeTokenService oneTimeTokenService ;
5925
+ private ReactiveOneTimeTokenService tokenService ;
5926
5926
5927
5927
private ServerAuthenticationConverter authenticationConverter = new ServerOneTimeTokenAuthenticationConverter ();
5928
5928
@@ -5936,15 +5936,15 @@ public final class OneTimeTokenLoginSpec {
5936
5936
5937
5937
private final List <ServerAuthenticationSuccessHandler > authenticationSuccessHandlers = new ArrayList <>();
5938
5938
5939
- private ServerGeneratedOneTimeTokenHandler generatedOneTimeTokenHandler ;
5939
+ private ServerOneTimeTokenGenerationSuccessHandler tokenGenerationSuccessHandler ;
5940
5940
5941
5941
private ServerSecurityContextRepository securityContextRepository ;
5942
5942
5943
5943
private String loginProcessingUrl = "/login/ott" ;
5944
5944
5945
5945
private String defaultSubmitPageUrl = "/login/ott" ;
5946
5946
5947
- private String generateTokenUrl = "/ott/generate" ;
5947
+ private String tokenGeneratingUrl = "/ott/generate" ;
5948
5948
5949
5949
private boolean submitPageEnabled = true ;
5950
5950
@@ -5981,10 +5981,10 @@ private void configureSubmitPage(ServerHttpSecurity http) {
5981
5981
}
5982
5982
5983
5983
private void configureOttGenerateFilter (ServerHttpSecurity http ) {
5984
- GenerateOneTimeTokenWebFilter generateFilter = new GenerateOneTimeTokenWebFilter (getOneTimeTokenService (),
5985
- getGeneratedOneTimeTokenHandler ());
5984
+ GenerateOneTimeTokenWebFilter generateFilter = new GenerateOneTimeTokenWebFilter (getTokenService (),
5985
+ getTokenGenerationSuccessHandler ());
5986
5986
generateFilter
5987
- .setRequestMatcher (ServerWebExchangeMatchers .pathMatchers (HttpMethod .POST , this .generateTokenUrl ));
5987
+ .setRequestMatcher (ServerWebExchangeMatchers .pathMatchers (HttpMethod .POST , this .tokenGeneratingUrl ));
5988
5988
http .addFilterAt (generateFilter , SecurityWebFiltersOrder .ONE_TIME_TOKEN );
5989
5989
}
5990
5990
@@ -5994,7 +5994,7 @@ private void configureDefaultLoginPage(ServerHttpSecurity http) {
5994
5994
OrderedWebFilter orderedWebFilter = (OrderedWebFilter ) webFilter ;
5995
5995
if (orderedWebFilter .webFilter instanceof LoginPageGeneratingWebFilter loginPageGeneratingFilter ) {
5996
5996
loginPageGeneratingFilter .setOneTimeTokenEnabled (true );
5997
- loginPageGeneratingFilter .setGenerateOneTimeTokenUrl (this .generateTokenUrl );
5997
+ loginPageGeneratingFilter .setGenerateOneTimeTokenUrl (this .tokenGeneratingUrl );
5998
5998
break ;
5999
5999
}
6000
6000
}
@@ -6072,7 +6072,7 @@ public OneTimeTokenLoginSpec authenticationManager(ReactiveAuthenticationManager
6072
6072
ReactiveAuthenticationManager getAuthenticationManager () {
6073
6073
if (this .authenticationManager == null ) {
6074
6074
ReactiveUserDetailsService userDetailsService = getBean (ReactiveUserDetailsService .class );
6075
- return new OneTimeTokenReactiveAuthenticationManager (getOneTimeTokenService (), userDetailsService );
6075
+ return new OneTimeTokenReactiveAuthenticationManager (getTokenService (), userDetailsService );
6076
6076
}
6077
6077
return this .authenticationManager ;
6078
6078
}
@@ -6082,22 +6082,22 @@ ReactiveAuthenticationManager getAuthenticationManager() {
6082
6082
* {@link OneTimeToken}
6083
6083
* @param oneTimeTokenService
6084
6084
*/
6085
- public OneTimeTokenLoginSpec oneTimeTokenService (ReactiveOneTimeTokenService oneTimeTokenService ) {
6085
+ public OneTimeTokenLoginSpec tokenService (ReactiveOneTimeTokenService oneTimeTokenService ) {
6086
6086
Assert .notNull (oneTimeTokenService , "oneTimeTokenService cannot be null" );
6087
- this .oneTimeTokenService = oneTimeTokenService ;
6087
+ this .tokenService = oneTimeTokenService ;
6088
6088
return this ;
6089
6089
}
6090
6090
6091
- ReactiveOneTimeTokenService getOneTimeTokenService () {
6092
- if (this .oneTimeTokenService != null ) {
6093
- return this .oneTimeTokenService ;
6091
+ ReactiveOneTimeTokenService getTokenService () {
6092
+ if (this .tokenService != null ) {
6093
+ return this .tokenService ;
6094
6094
}
6095
6095
ReactiveOneTimeTokenService oneTimeTokenService = getBeanOrNull (ReactiveOneTimeTokenService .class );
6096
6096
if (oneTimeTokenService != null ) {
6097
6097
return oneTimeTokenService ;
6098
6098
}
6099
- this .oneTimeTokenService = new InMemoryReactiveOneTimeTokenService ();
6100
- return this .oneTimeTokenService ;
6099
+ this .tokenService = new InMemoryReactiveOneTimeTokenService ();
6100
+ return this .tokenService ;
6101
6101
}
6102
6102
6103
6103
/**
@@ -6153,21 +6153,21 @@ public OneTimeTokenLoginSpec defaultSubmitPageUrl(String submitPageUrl) {
6153
6153
* Specifies strategy to be used to handle generated one-time tokens.
6154
6154
* @param generatedOneTimeTokenHandler
6155
6155
*/
6156
- public OneTimeTokenLoginSpec generatedOneTimeTokenHandler (
6157
- ServerGeneratedOneTimeTokenHandler generatedOneTimeTokenHandler ) {
6156
+ public OneTimeTokenLoginSpec tokenGenerationSuccessHandler (
6157
+ ServerOneTimeTokenGenerationSuccessHandler generatedOneTimeTokenHandler ) {
6158
6158
Assert .notNull (generatedOneTimeTokenHandler , "generatedOneTimeTokenHandler cannot be null" );
6159
- this .generatedOneTimeTokenHandler = generatedOneTimeTokenHandler ;
6159
+ this .tokenGenerationSuccessHandler = generatedOneTimeTokenHandler ;
6160
6160
return this ;
6161
6161
}
6162
6162
6163
6163
/**
6164
6164
* Specifies the URL that a One-Time Token generate request will be processed.
6165
6165
* Defaults to {@code /ott/generate}.
6166
- * @param generateTokenUrl
6166
+ * @param tokenGeneratingUrl
6167
6167
*/
6168
- public OneTimeTokenLoginSpec generateTokenUrl (String generateTokenUrl ) {
6169
- Assert .hasText (generateTokenUrl , "generateTokenUrl cannot be null or empty" );
6170
- this .generateTokenUrl = generateTokenUrl ;
6168
+ public OneTimeTokenLoginSpec tokenGeneratingUrl (String tokenGeneratingUrl ) {
6169
+ Assert .hasText (tokenGeneratingUrl , "tokenGeneratingUrl cannot be null or empty" );
6170
+ this .tokenGeneratingUrl = tokenGeneratingUrl ;
6171
6171
return this ;
6172
6172
}
6173
6173
@@ -6187,17 +6187,17 @@ public OneTimeTokenLoginSpec securityContextRepository(
6187
6187
return this ;
6188
6188
}
6189
6189
6190
- private ServerGeneratedOneTimeTokenHandler getGeneratedOneTimeTokenHandler () {
6191
- if (this .generatedOneTimeTokenHandler == null ) {
6192
- this .generatedOneTimeTokenHandler = getBeanOrNull (ServerGeneratedOneTimeTokenHandler .class );
6190
+ private ServerOneTimeTokenGenerationSuccessHandler getTokenGenerationSuccessHandler () {
6191
+ if (this .tokenGenerationSuccessHandler == null ) {
6192
+ this .tokenGenerationSuccessHandler = getBeanOrNull (ServerOneTimeTokenGenerationSuccessHandler .class );
6193
6193
}
6194
- if (this .generatedOneTimeTokenHandler == null ) {
6194
+ if (this .tokenGenerationSuccessHandler == null ) {
6195
6195
throw new IllegalStateException ("""
6196
6196
A ServerGeneratedOneTimeTokenHandler is required to enable oneTimeTokenLogin().
6197
6197
Please provide it as a bean or pass it to the oneTimeTokenLogin() DSL.
6198
6198
""" );
6199
6199
}
6200
- return this .generatedOneTimeTokenHandler ;
6200
+ return this .tokenGenerationSuccessHandler ;
6201
6201
}
6202
6202
6203
6203
}
0 commit comments