修改登录地址获取
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
#### 项目介绍
|
||||
定位为所有文档的管理项目,swagger文档、dubbo文档、数据库文档....等,提供一整套的解决方案,为开发者服务,欢迎有想法的一起来写,给个Star鼓励下呗!(您的一个Star是快速迭代的动力源泉!)
|
||||
|
||||
体验地址:[http://doc.zyplayer.com](http://doc.zyplayer.com/zyplayer-doc-manage/static/manage/home.html) 账号:zyplayer 密码:123456 (不能体验数据库文档和dubbo文档)
|
||||
|
||||
#### 软件架构
|
||||
##### 一、zyplayer-doc-core 一些核心、公用的类
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.zyplayer.doc.manage.framework.config.security;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.RememberMeAuthenticationProvider;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
@@ -12,24 +12,21 @@ import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
|
||||
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
||||
import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
|
||||
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
|
||||
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
import org.springframework.security.web.authentication.*;
|
||||
import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter;
|
||||
import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices;
|
||||
import org.springframework.util.DigestUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Order(1)
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@EnableGlobalMethodSecurity(prePostEnabled = true)
|
||||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
|
||||
@Value("${zyplayer.doc.manage.login-page}")
|
||||
private String loginPage;
|
||||
|
||||
@Bean
|
||||
@Override
|
||||
public AuthenticationManager authenticationManagerBean() throws Exception {
|
||||
@@ -46,11 +43,10 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
String loginPage = "/static/manage/login.html";
|
||||
// 无需登录即可访问的接口
|
||||
String[] permitAllAntPatterns = {
|
||||
// 登录接口
|
||||
"/login/**",
|
||||
"/login/**", "/static/manage/login.html",
|
||||
// 开放接口的静态文件和接口
|
||||
"/open-doc.html", "/webjars/open-doc/**", "/swagger-mg-ui/open-doc/**",
|
||||
// http代理请求接口,有白名单限制,也不怕随便请求到内网资源了
|
||||
|
||||
@@ -15,9 +15,9 @@ zyplayer:
|
||||
dubbo:
|
||||
# 优先使用zookeeper,未配置时找nacos的配置
|
||||
zookeeper:
|
||||
url: 127.0.0.1:2181
|
||||
# url: 127.0.0.1:2181
|
||||
nacos:
|
||||
url: http://127.0.0.1:8848/nacos
|
||||
# url: http://127.0.0.1:8848/nacos
|
||||
# 服务名称,多个使用 ; 分割,nacos没办法获取所有的服务列表,所以需要指定
|
||||
service: "com.zyplayer.dubbo.service.UserService;\
|
||||
com.zyplayer.dubbo.service.AnnotateService;"
|
||||
@@ -33,6 +33,9 @@ zyplayer:
|
||||
url: jdbc:mysql://127.0.0.1:3306/zyplayer_doc_manage?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||
username: root
|
||||
password: root
|
||||
# 通过nginx代理之后没端口,但tomcat容器有端口,spring security会判断如果是http开头的则直接跳
|
||||
# 如果你也遇到了这个问题,可以把登陆地址写成http://开头的一个地址
|
||||
login-page: /static/manage/login.html
|
||||
# 数据库文档相关
|
||||
# 打开/zyplayer_doc_manage/doc-db.html即可看到这里配置的数据库的文档
|
||||
db:
|
||||
|
||||
@@ -79,6 +79,9 @@
|
||||
} else {
|
||||
app.passwordError = "登录失败," + result.errMsg;
|
||||
}
|
||||
}, function(){
|
||||
// 通过nginx代理之后没端口,但tomcat容器有端口,会跨域异常,但正常登陆了的,直接跳
|
||||
location.href = ctx + "static/manage/home.html";
|
||||
});
|
||||
},
|
||||
init: function () {
|
||||
|
||||
Reference in New Issue
Block a user