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) {
121121			ReactiveAuthorizationManager <PayloadExchangeAuthorizationContext > anonymous  = (authentication ,
122122					exchange ) -> authentication .map (trustResolver ::isAnonymous ).map (AuthorizationDecision ::new );
123123			rsocket .authorizePayload ((authorize ) -> authorize .anyExchange ().access (anonymous ));
124+ 			rsocket .anonymousAuthentication ((anonymousAuthentication ) -> anonymousAuthentication .disable ());
124125			return  rsocket .build ();
125126		}
126127
Original file line number Diff line number Diff line change @@ -268,8 +268,7 @@ PayloadSocketAcceptorInterceptor rsocketInterceptor(RSocketSecurity rsocket) {
268268					.route ("secure.*" ).authenticated ()
269269					.anyExchange ().permitAll ()
270270				)
271- 				.basicAuthentication (Customizer .withDefaults ())
272- 					.anonymousAuthentication (Customizer .withDefaults ());
271+ 				.basicAuthentication (Customizer .withDefaults ());
273272			// @formatter:on 
274273			return  rsocket .build ();
275274		}
Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ public class RSocketSecurity {
120120
121121	private  SimpleAuthenticationSpec  simpleAuthSpec ;
122122
123- 	private  AnonymousAuthenticationSpec  anonymousAuthSpec ;
123+ 	private  AnonymousAuthenticationSpec  anonymousAuthSpec  =  new   AnonymousAuthenticationSpec ( this ) ;
124124
125125	private  JwtSpec  jwtSpec ;
126126
@@ -174,7 +174,7 @@ public RSocketSecurity simpleAuthentication(Customizer<SimpleAuthenticationSpec>
174174	 */ 
175175	public  RSocketSecurity  anonymousAuthentication (Customizer <AnonymousAuthenticationSpec > anonymous ) {
176176		if  (this .anonymousAuthSpec  == null ) {
177- 			this .anonymousAuthSpec  = new  AnonymousAuthenticationSpec ();
177+ 			this .anonymousAuthSpec  = new  AnonymousAuthenticationSpec (this );
178178		}
179179		anonymous .customize (this .anonymousAuthSpec );
180180		return  this ;
@@ -297,7 +297,10 @@ protected AuthenticationPayloadInterceptor build() {
297297
298298	public  final  class  AnonymousAuthenticationSpec  {
299299
300- 		private  AnonymousAuthenticationSpec () {
300+ 		private  RSocketSecurity  parent ;
301+ 
302+ 		private  AnonymousAuthenticationSpec (RSocketSecurity  parent ) {
303+ 			this .parent  = parent ;
301304		}
302305
303306		protected  AnonymousPayloadInterceptor  build () {
@@ -306,6 +309,10 @@ protected AnonymousPayloadInterceptor build() {
306309			return  result ;
307310		}
308311
312+ 		public  void  disable () {
313+ 			this .parent .anonymousAuthSpec  = null ;
314+ 		}
315+ 
309316	}
310317
311318	public  final  class  BasicAuthenticationSpec  {
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments