访问 http://localhost:8080/oauth/authorize的时候报错

来源:6-2 实现标准的OAuth服务提供商

eddie_k2

2018-09-02

//img.mukewang.com/szimg/5b8bebf30001a29d11540813.jpg

http://img.mukewang.com/szimg/5b8c02820001485d12320789.jpg

http://localhost:8080/oauth/authorize?response_type=code&client_id=demo&redirect_uri=http://example.com&scope=all

错误如下: 

org.springframework.security.authentication.InsufficientAuthenticationException: User must be authenticated with Spring Security before authorization can be completed.


写回答

6回答

lisha2019

2020-08-03

在imooc-security-app中加两个类:如下

类1:

package com.imooc.security.app;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;

/**
* @author
*
*/
@Configuration
@EnableResourceServer
public class ImoocResourceServerConfig {

}


类2:

package com.imooc.security.app;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;

/**
* @author
*
*/
@Configuration
@EnableAuthorizationServer
public class ImoocAuthorizationServerConfig {

}

0
0

JoJo

2019-10-16

你是不是配置了/oauth/authorize不需要身份认证了?一般会进到这里都是因为配了/oauth/authorize不需要身份认证,去掉就好了,去掉以后如果没登录过,会要求用户登录,然后再跳回这里,就不会报这个错了。

这个问题之前有别的同学回答了,所以没出现在待回答问题列表里,刚刚才看到,不好意思啊。

0
0

DanielLi_

2019-02-19

我也遇到的同样的问题, 请问解决了吗?

0
0

jiiiiiin

2018-09-13

重定向地址错误

0
0

jiiiiiin

2018-09-13

重定向地址错误

0
0

eddie_k2

提问者

2018-09-03

JoJozhai老师 请说一下

0
1
crea_union
请问解决了吗?能告知下吗?
2019-06-19
共1条回复

Spring Security技术栈开发企业级认证与授权

Spring Security技术栈,REST风格开发常见接口,独立开发认证授权模块保证REST服务安全

2662 学习 · 1561 问题

查看课程