spring-boot - Springboot Oauth2:org.springframework.security.oauth2.provider.error.DefaultWebResponseExceptionTranslator$UnauthorizedException
问题描述
我正在尝试实现一个功能齐全的 Spring-boot oauth2。我设法使用成功凭据实现登录,我使用 access_token 和 refresh_token 得到正确的响应,使用/oauth/token
使用正确的用户名和密码
{
"access_token": "b8c45984-c573-4837-9ef6-6896f308a286",
"token_type": "bearer",
"refresh_token": "48145463-830e-4467-ab89-587bda6b32de",
"expires_in": 43199,
"scope": "read write"
}
如果我使用了错误的用户名,它会给我一个正确的错误,我很高兴;
错误的用户名:
{error: "unauthorized", error_description: "No value present"}
错误:“未经授权” error_description:“没有值存在”
但是当我使用正确的用户名和错误的密码时问题就来了;我收到以下错误
2018-05-28 14:47:25.264 WARN 6604 --- [nio-8088-exec-2] .c.j.MappingJackson2HttpMessageConverter :
Failed to evaluate Jackson serialization for type [class org.springframework.security.oauth2.provider.error.DefaultWebResponseExceptionTranslator$UnauthorizedException]:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.oauth2.common.exceptions.OAuth2ExceptionJackson2Serializer':
BeanPostProcessor before instantiation of bean failed;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'org.springframework.transaction.config.internalTransactionAdvisor' defined in class path resource
[org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.class]:
Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor]:
Factory method 'transactionAdvisor' threw exception;
nested exception is java.lang.NullPointerException
解决方案
推荐阅读
- regex - 正则表达式中的转义括号与交替
- oracle - 无法在 AWS Elastic Beanstalk 中配置 Oracle RDS 实例
- python - 未更新的空列表列表的类初始化
- docusignapi - 如何创建带有signingGroup 收件人的信封?
- jenkins - 如何使用多项选择来运行作业?
- php - 我在 Wordpress 中使用 node/webpack
- php - Debian/Stable (Buster) 系统上的 php (php-mime-mail) 设置
- python - 从长字符串中删除任何出现的“(...)”,其中“...”可以是任何东西
- django - Django 单元测试因唯一约束而失败
- javascript - Nodejs安全问题客户端发送请求