海伦网站建设,做网站建设的联系电话,中国建筑网官网app,嵌入式软件开发价格项目场景#xff1a;
相关背景#xff1a;
使用idea 开发java 项目#xff0c;前端页面请求 页面中相关的接口时#xff0c;idea 控制台有报错信息出现#xff0c;前端请求失败。 问题描述
问题#xff1a;
使用idea 开发java 项目#xff0c;前端页面请求 页面中相…项目场景
相关背景
使用idea 开发java 项目前端页面请求 页面中相关的接口时idea 控制台有报错信息出现前端请求失败。 问题描述
问题
使用idea 开发java 项目前端页面请求 页面中相关的接口时idea 控制台有报错信息出现前端请求失败。报错信息如下所示
code: 500 ] This subject is anonymous - it does not have any identifying principals and authorization operations require an identity to check against. A Subject instance will acquire these identifying principals automatically after a successful login is performed be executing org.apache.shiro.subject.Subject.login(AuthenticationToken) or when Remember Me functionality is enabled by the SecurityManager. This exception can also occur when a previously logged-in Subject has logged out which makes it anonymous again. Because an identity is currently not known due to any of these conditions, authorization is denied.: http://localhost:8090/act/model/list原因分析 分析问题 这个错误是由于在使用 Apache Shiro 安全框架时当前主体Subject未经过身份验证而执行了授权操作导致没有任何可用的身份信息进行检查。 解决方案 解决方案 1、首先需要确认当前主体是否已经经过身份验证。 2、如果当前主体确实需要进行授权操作需要先进行身份验证然后再执行授权操作。身份验证可以通过调用 Subject.login(AuthenticationToken) 方法实现。
3、如果在使用 Shiro 的“Remember Me”功能时出现此问题则需要启用 SecurityManager 中的此功能以允许主体在下一次访问时自动恢复身份信息。
此外如果先前已经登录的主体已经退出系统则当前主体将被认为是匿名的而无法进行授权操作。 所以在这种情况下需要重新进行身份验证并重新授权。
在解决此问题时你还应该检查您在代码中的使用是否正确以确保你的程序使用 Shiro 的安全功能时没有出现任何错误。
解决方法在shiro配置时将该请求配置了anon 具体请求接口配置方式
我的问题解决啦希望你们的问题也顺利解决啦~~~