[英]How to separate authorization server spring security in java
我已經開始學習彈簧安全性(Oauth2)。 我有一個受Spring Oauth2保護的REST API服務。 我想要做的是,我想分離授權服務器和資源服務器,例如,
和資源http:// server1:8080 / RESTTest / api / users /?access_token = 2cf682c6-2900-47dc-a468-441fcee0dc18
我想要的是,
授權: http:// Server1:8080 / authorizationserver / oauth / token / grant_type = client_credentials&client_id = clientt&client_secret = secret
資源: http:// server2:8080 / RESTTest / api / users /?access_token = 2cf682c6-2900-47dc-a468-441fcee0dc18
我正在使用JDBCTokenstore 。 我不知道如何分開它。 有人能幫我嗎。
謝謝,
您可以將自定義端點映射到提供的默認端點,fyi http://projects.spring.io/spring-security-oauth/docs/oauth2.html
@Configuration
@EnableAuthorizationServer
protected static class AuthorizationServerConfiguration extends AuthorizationServerConfigurerAdapter {
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
endpoints.tokenStore(tokenStore).userApprovalHandler(userApprovalHandler)
.authenticationManager(authenticationManager);
endpoints.pathMapping("/oauth/token", "/authorizationserver/oauth/token")
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.