Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authorization_code模式 获取access_token之后,如何去请求资源? #15

Open
pepsiyoung opened this issue Jun 26, 2018 · 5 comments

Comments

@pepsiyoung
Copy link

pepsiyoung commented Jun 26, 2018

authorization_code模式 获取access_token之后如何去请求资源服务器,
access_token在哪里传,我直接用get获取不了?

@zx8329200
Copy link

这个作者没有写。其实还是要有一个验证token然后获得请求资源的方法

@pepsiyoung pepsiyoung changed the title authorization_code模式 获取access_token之后 authorization_code模式 获取access_token之后,如何去请求资源? Jul 2, 2018
@pepsiyoung
Copy link
Author

@zx8329200 找了很久没找到适用的,能否提供下代码

@shancg
Copy link

shancg commented Jul 11, 2018

@zx8329200 这个怎么写?网上有大概的例子么?找了好多都无效啊

@pepsiyoung
Copy link
Author

SecurityConfiguration 类 void configure(HttpSecurity http)方法 改为以下就可以了
http
.requestMatchers()
.antMatchers("/oauth/","/login/","/logout/")
.and()
.authorizeRequests()
.antMatchers("/oauth/
").authenticated()
.and()
.formLogin().loginPage("/login")
.and()
.httpBasic().disable()
.csrf()
// 不需要被csrf过滤的请求
.requireCsrfProtectionMatcher(new AntPathRequestMatcher("/oauth/authorize"))
.disable();

@lexburner
Copy link
Owner

@pozhenzi9010 @zx8329200 @shancg 授权码模式demo已更新,pull 之后重新看下吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants