更新 resource

2.0.0
monkeyk7 2018-04-21 00:41:05 +08:00
parent c53c8c37a0
commit a78fbd716c
3 changed files with 7 additions and 6 deletions

View File

@ -38,11 +38,12 @@ http://localhost:8080/spring-oauth-server/oauth/token?client_id=mobile-client&cl
Restful OAuth2 Test [POST] Restful OAuth2 Test [POST]
URL: /oauth2/rest_token URL: /oauth/rest_token
ContentType: application/json ContentType: application/json
DEMO URL: http://localhost:8080/spring-oauth-server/oauth2/rest_token DEMO URL: http://localhost:8080/spring-oauth-server/oauth2/rest_token
Request Body: {"grant_type":"client_credentials","scope":"read","client_id":"credentials","client_secret":"credentials","username":"user","password":"123"} Request Body:
{"grant_type":"client_credentials","scope":"read","client_id":"credentials","client_secret":"credentials","username":"user","password":"123"}
Response Body: Response Body:
{ {
@ -56,7 +57,7 @@ Response Body:
更多的测试请访问 更多的测试请访问
http://git.oschina.net/mkk/spring-oauth-client https://gitee.com/mkk/spring-oauth-client
------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------

View File

@ -47,12 +47,12 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
@Override @Override
protected void configure(HttpSecurity http) throws Exception { protected void configure(HttpSecurity http) throws Exception {
http.csrf().ignoringAntMatchers("/oauth/authorize", "/oauth/token"); http.csrf().ignoringAntMatchers("/oauth/authorize", "/oauth/token", "/oauth/rest_token");
http.authorizeRequests() http.authorizeRequests()
.antMatchers("/public/**").permitAll() .antMatchers("/public/**").permitAll()
.antMatchers("/static/**").permitAll() .antMatchers("/static/**").permitAll()
.antMatchers("/oauth2/rest_token*").permitAll() .antMatchers("/oauth/rest_token*").permitAll()
.antMatchers("/login*").permitAll() .antMatchers("/login*").permitAll()
.antMatchers("/user/**").hasAnyRole("ADMIN") .antMatchers("/user/**").hasAnyRole("ADMIN")

View File

@ -76,7 +76,7 @@ public class OAuthRestController implements InitializingBean, ApplicationContext
private WebResponseExceptionTranslator providerExceptionHandler = new DefaultWebResponseExceptionTranslator(); private WebResponseExceptionTranslator providerExceptionHandler = new DefaultWebResponseExceptionTranslator();
@RequestMapping(value = "/oauth2/rest_token", method = RequestMethod.POST) @RequestMapping(value = "/oauth/rest_token", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public OAuth2AccessToken postAccessToken(@RequestBody Map<String, String> parameters) { public OAuth2AccessToken postAccessToken(@RequestBody Map<String, String> parameters) {