Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package com.company.communication.relay.configuration;
import com.company.communication.relay.client.UserAuthenticationClient;
import com.company.communication.relay.interceptor.AuthenticationChannelInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.messaging.simp.config.ChannelRegistration;
import org.springframework.web.socket.config.annotation.AbstractWebSocketMessageBrokerConfigurer;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
@Configuration
@Order(Ordered.HIGHEST_PRECEDENCE + 99)
@EnableConfigurationProperties(RelayAuthenticationProperties.class)
public class RelayAuthenticationConfiguration extends AbstractWebSocketMessageBrokerConfigurer
{
private final RelayAuthenticationProperties properties;
@Autowired
public RelayAuthenticationConfiguration(final RelayAuthenticationProperties properties)
{
this.properties = properties;
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry)
{
// Do nothing
}
@Override
public void configureClientInboundChannel(final ChannelRegistration registration)
{
final UserAuthenticationClient userAuthenticationClient = <how do I get the Feign built class here?>
registration.setInterceptors(authenticationChannelInterceptor(userAuthenticationClient));
}
@Bean
public AuthenticationChannelInterceptor authenticationChannelInterceptor(
final UserAuthenticationClient userAuthenticationClient
)
{
return new AuthenticationChannelInterceptor(userAuthenticationClient);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.