Created
January 25, 2018 17:11
-
-
Save guilhermeblanco/60a819b45318454bf088aa2566debd59 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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