关注JEECG发展历程 关注最新动态和版本, 记录JEECG成长点滴 更新日志 - 技术支持 - 招聘英才

JEECG最新版本下载 JEECG智能开发平台 - 显著提高开发效率 常见问题 - 入门视频 - 参与开源团队

商务QQ: 69893005、3102411850 商务热线(5*8小时): 010-64808099 官方邮箱: jeecgos@163.com

查看: 8888|回复: 4

登录失败,token为空--已解决

[复制链接]
发表于 2019-10-10 12:03:47 | 显示全部楼层 |阅读模式
本帖最后由 lycplayer 于 2019-10-10 15:06 编辑

部署上线后,浏览器看到登录页,输入帐号密码,页面提示token无效。奇怪的是log里只看到这点信息

2019-10-10 11:59:37.500 [http-nio2-8060-exec-8] INFO  org.jeecg.modules.shiro.authc.ShiroRealm:90 - ————————身份认证失败——————————IP地址:  183.220.113.170
2019-10-10 11:59:37.502 [http-nio2-8060-exec-8] ERROR o.s.boot.web.servlet.support.ErrorPageFilter:190 - Forwarding to error page from request [/jeecg-boot-module-system-2.1.0/sys/login] due to exception [org.apache.shiro.authc.AuthenticationException: Token失效,请重新登录]
javax.servlet.ServletException: org.apache.shiro.authc.AuthenticationException: Token失效,请重新登录


 楼主| 发表于 2019-10-10 12:44:40 | 显示全部楼层
前端配置也是外网可访问的IP地址
window._CONFIG = {};
    window._CONFIG['domianURL'] = 'http://外网ip:8060/jeecg-boot/jeecg-boot-module-system-2.1.0';
    window._CONFIG['casPrefixUrl'] = 'http://cas.example.org:8443/cas';
    window._CONFIG['imgDomainURL'] = window._CONFIG['domianURL'] + '/sys/common/view';
    window._CONFIG['pdfDomainURL'] =  window._CONFIG['domianURL'] + '/sys/common/pdf/pdfPreviewIframe';
 楼主| 发表于 2019-10-10 14:03:58 | 显示全部楼层
看代码,是这里
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken auth) throws AuthenticationException {
                String token = (String) auth.getCredentials();
                if (token == null) {
                        log.info("————————身份认证失败——————————IP地址:  "+ oConvertUtils.getIpAddrByRequest(SpringContextUtils.getHttpServletRequest()));
                        throw new AuthenticationException("token为空!");
                }
 楼主| 发表于 2019-10-10 14:12:03 | 显示全部楼层
server {
                listen       80;
                server_name  域名;

                #后台服务配置,配置了这个location便可以通过http://域名/jeecg-boot/xxxx 访问
                location ^~ /jeecg-boot {
                        proxy_pass              http://127.0.0.1:8060/jeecg-boot/jeecg-boot-module-system-2.1.0;
                        proxy_set_header        Host 127.0.0.1;
                        proxy_set_header        X-Real-IP $remote_addr;
                        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                }
                #解决Router(mode: 'history')模式下,刷新路由地址不能找到页面的问题
                location / {
                        root   html;
                        index  index.html index.htm;
                        if (!-e $request_filename) {
                                rewrite ^(.*)$ /index.html?s=$1 last;
                                break;
                        }
                }
        }
 楼主| 发表于 2019-10-10 15:05:53 | 显示全部楼层
搞定了!proxy_pass              http://127.0.0.1:8060/jeecg-boot/
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表