oauth2 /oauth/authorize 没有权限 50

/oauth/token可以拿到access_token但是通过access_token去访问资源就没有权限了,后台日志显示访问/oauth/authorize没有权限1... /oauth/token 可以拿到access_token
但是通过access_token 去访问资源就没有权限了, 后台日志显示 访问/oauth/authorize 没有权限
11-13 17:04:19.191 DEBUG [o.s.s.w.access.intercept.FilterSecurityInterceptor] - Secure object: FilterInvocation: URL: /oauth/authorize?client_id=test&redirect_uri=http%3A%2F%2F10.5.4.250%3A1113%2Flogin&response_type=code&scope=server&state=W9ejN3; Attributes: [authenticated]
11-13 17:04:19.191 DEBUG [o.s.s.w.access.intercept.FilterSecurityInterceptor] - Previously Authenticated: org.springframework.security.authentication.AnonymousAuthenticationToken@56f892e0: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@b364: RemoteIpAddress: 10.5.4.250; SessionId: null; Granted Authorities: ROLE_ANONYMOUS
11-13 17:04:19.192 DEBUG [o.s.security.access.vote.AffirmativeBased] - Voter: org.springframework.security.web.access.expression.WebExpressionVoter@7a80525b, returned: -1
11-13 17:04:19.193 DEBUG [o.s.boot.actuate.audit.listener.AuditListener] - AuditEvent [timestamp=2018-11-13T09:04:19.193Z, principal=anonymousUser, type=AUTHORIZATION_FAILURE, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@b364: RemoteIpAddress: 10.5.4.250; SessionId: null, type=org.springframework.security.access.AccessDeniedException, message=Access is denied}]
11-13 17:04:19.194 DEBUG [o.s.security.web.access.ExceptionTranslationFilter] - Access is denied (user is anonymous); redirecting to authentication entry point
org.springframework.security.access.AccessDeniedException: Access is denied
at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:84)
展开
 我来答
php学习之道
2020-06-24
知道答主
回答量:29
采纳率:0%
帮助的人:4.3万
展开全部

在WebSecurityConfig的config方法中加上上面红色标记的代码

已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式