【发布时间】:2016-04-04 10:25:46
【问题描述】:
我正在为 REST 服务实现 Spring 集成。我正在关注 XPadro 的 githib 示例 - https://github.com/xpadro/spring-integration。
我创建了简单的读、写和更新操作。
示例取自 int-http-dsl 项目。
我想用 oath2 实现 spring-security。我正在参考http://docs.spring.io/spring-integration/reference/html/security.html。
我无法将两者连接在一起。因为下面是他们映射请求的方式
@Bean
public IntegrationFlow httpGetFlow() {
return IntegrationFlows.from(httpGetGate()).channel("httpGetChannel").handle("personEndpoint", "get").get();
}
@Bean
public MessagingGatewaySupport httpGetGate() {
HttpRequestHandlingMessagingGateway handler = new HttpRequestHandlingMessagingGateway();
handler.setRequestMapping(createMapping(new HttpMethod[]{HttpMethod.GET}, "/persons/{personId}"));
handler.setPayloadExpression(parser().parseExpression("#pathVariables.personId"));
handler.setHeaderMapper(headerMapper());
return handler;
}
以下是我们如何集成安全性
@Bean
@SecuredChannel(interceptor = "channelSecurityInterceptor", sendAccess = "ROLE_ADMIN")
public SubscribableChannel adminChannel() {
return new DirectChannel();
}
我无法在第一个示例中找到创建渠道的方法,因此如何集成。
我的方向是正确的还是完全错了?
有没有更好的教程来处理 spring-integration (http) 和 spring-security(使用 oauth)?
【问题讨论】:
标签: spring-security spring-integration spring-security-oauth2