File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed
integration-test/java/org/springframework/security/config/annotation/rsocket
main/java/org/springframework/security/config/annotation/rsocket Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,7 @@ PayloadSocketAcceptorInterceptor rsocketInterceptor(RSocketSecurity rsocket) {
121
121
ReactiveAuthorizationManager <PayloadExchangeAuthorizationContext > anonymous = (authentication ,
122
122
exchange ) -> authentication .map (trustResolver ::isAnonymous ).map (AuthorizationDecision ::new );
123
123
rsocket .authorizePayload ((authorize ) -> authorize .anyExchange ().access (anonymous ));
124
+ rsocket .anonymousAuthentication ((anonymousAuthentication ) -> anonymousAuthentication .disable ());
124
125
return rsocket .build ();
125
126
}
126
127
Original file line number Diff line number Diff line change @@ -268,8 +268,7 @@ PayloadSocketAcceptorInterceptor rsocketInterceptor(RSocketSecurity rsocket) {
268
268
.route ("secure.*" ).authenticated ()
269
269
.anyExchange ().permitAll ()
270
270
)
271
- .basicAuthentication (Customizer .withDefaults ())
272
- .anonymousAuthentication (Customizer .withDefaults ());
271
+ .basicAuthentication (Customizer .withDefaults ());
273
272
// @formatter:on
274
273
return rsocket .build ();
275
274
}
Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ public class RSocketSecurity {
120
120
121
121
private SimpleAuthenticationSpec simpleAuthSpec ;
122
122
123
- private AnonymousAuthenticationSpec anonymousAuthSpec ;
123
+ private AnonymousAuthenticationSpec anonymousAuthSpec = new AnonymousAuthenticationSpec ( this ) ;
124
124
125
125
private JwtSpec jwtSpec ;
126
126
@@ -174,7 +174,7 @@ public RSocketSecurity simpleAuthentication(Customizer<SimpleAuthenticationSpec>
174
174
*/
175
175
public RSocketSecurity anonymousAuthentication (Customizer <AnonymousAuthenticationSpec > anonymous ) {
176
176
if (this .anonymousAuthSpec == null ) {
177
- this .anonymousAuthSpec = new AnonymousAuthenticationSpec ();
177
+ this .anonymousAuthSpec = new AnonymousAuthenticationSpec (this );
178
178
}
179
179
anonymous .customize (this .anonymousAuthSpec );
180
180
return this ;
@@ -297,7 +297,10 @@ protected AuthenticationPayloadInterceptor build() {
297
297
298
298
public final class AnonymousAuthenticationSpec {
299
299
300
- private AnonymousAuthenticationSpec () {
300
+ private RSocketSecurity parent ;
301
+
302
+ private AnonymousAuthenticationSpec (RSocketSecurity parent ) {
303
+ this .parent = parent ;
301
304
}
302
305
303
306
protected AnonymousPayloadInterceptor build () {
@@ -306,6 +309,10 @@ protected AnonymousPayloadInterceptor build() {
306
309
return result ;
307
310
}
308
311
312
+ public void disable () {
313
+ this .parent .anonymousAuthSpec = null ;
314
+ }
315
+
309
316
}
310
317
311
318
public final class BasicAuthenticationSpec {
You can’t perform that action at this time.
0 commit comments