|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2012-2020 the original author or authors. |
|
|
|
|
* Copyright 2012-2022 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -18,10 +18,12 @@ package org.springframework.boot.autoconfigure.security.rsocket;
@@ -18,10 +18,12 @@ package org.springframework.boot.autoconfigure.security.rsocket;
|
|
|
|
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
|
|
|
|
import org.springframework.boot.autoconfigure.rsocket.RSocketMessageHandlerCustomizer; |
|
|
|
|
import org.springframework.boot.rsocket.server.RSocketServerCustomizer; |
|
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
|
import org.springframework.security.config.annotation.rsocket.EnableRSocketSecurity; |
|
|
|
|
import org.springframework.security.messaging.handler.invocation.reactive.AuthenticationPrincipalArgumentResolver; |
|
|
|
|
import org.springframework.security.rsocket.core.SecuritySocketAcceptorInterceptor; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -30,6 +32,7 @@ import org.springframework.security.rsocket.core.SecuritySocketAcceptorIntercept
@@ -30,6 +32,7 @@ import org.springframework.security.rsocket.core.SecuritySocketAcceptorIntercept
|
|
|
|
|
* |
|
|
|
|
* @author Madhura Bhave |
|
|
|
|
* @author Brian Clozel |
|
|
|
|
* @author Guirong Hu |
|
|
|
|
* @since 2.2.0 |
|
|
|
|
*/ |
|
|
|
|
@Configuration(proxyBeanMethods = false) |
|
|
|
|
@ -42,4 +45,16 @@ public class RSocketSecurityAutoConfiguration {
@@ -42,4 +45,16 @@ public class RSocketSecurityAutoConfiguration {
|
|
|
|
|
return (server) -> server.interceptors((registry) -> registry.forSocketAcceptor(interceptor)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ConditionalOnClass(AuthenticationPrincipalArgumentResolver.class) |
|
|
|
|
@Configuration(proxyBeanMethods = false) |
|
|
|
|
static class RSocketSecurityMessageHandlerConfiguration { |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
RSocketMessageHandlerCustomizer rSocketAuthenticationPrincipalMessageHandlerCustomizer() { |
|
|
|
|
return (messageHandler) -> messageHandler.getArgumentResolverConfigurer() |
|
|
|
|
.addCustomResolver(new AuthenticationPrincipalArgumentResolver()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|