登录页面联调
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#欢迎查看spring security browser权限认证框架说明
|
||||
|
||||
##相关配置参数说明
|
||||
- `ms.security.browser.html` 自定义登录页面的地址(必须参数)
|
||||
- `ms.security.browser.html` 自定义登录页面的地址(不一定必须参数)
|
||||
- `ms.security.browser.loginType` 身份认证后响应类型`REDIRECT`页面形式响应,`JSON`, json形式的响应
|
||||
- `ms.security.browser.rememberMeSeconds` 记住我的时间,单位是秒,默认的时间是3600秒,`remember-me`参数,值为`true`
|
||||
- `/authentication/require`处理身份认证跳转的接口地址
|
||||
|
||||
+3
-1
@@ -19,6 +19,7 @@ import org.springframework.security.web.authentication.UsernamePasswordAuthentic
|
||||
import org.springframework.security.web.authentication.rememberme.JdbcTokenRepositoryImpl;
|
||||
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
@@ -67,6 +68,7 @@ public class BrowserSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
@Autowired
|
||||
private UserDetailsService userDetailsService;
|
||||
|
||||
|
||||
/**
|
||||
* 短信验证码登录的配置
|
||||
*/
|
||||
@@ -149,7 +151,7 @@ public class BrowserSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
JdbcTokenRepositoryImpl jdbcTokenRepository = new JdbcTokenRepositoryImpl();
|
||||
jdbcTokenRepository.setDataSource(dataSource);
|
||||
//启动的时候创建表
|
||||
jdbcTokenRepository.setCreateTableOnStartup(true);
|
||||
jdbcTokenRepository.setCreateTableOnStartup(securityProperties.getCreateRememberTable());
|
||||
return jdbcTokenRepository;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public class BrowserSecurityController {
|
||||
}
|
||||
}
|
||||
//如果是异步请求的话就放回404状态码和提示信息
|
||||
return "访问的服务需要身份认证,需要引导用户到身份认证页面";
|
||||
return "未进行身份认证";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,4 +21,5 @@
|
||||
- 同样的,可以实现`validateCode`生成验证码的方法,并定义名称为`smsCodeUtil`的bean便可替换原有的短信验证码的生成逻辑
|
||||
|
||||
- 短信登录的接口为`/authentication/mobile`,传递参数为`smsCode`和`mobile`
|
||||
- `ms.security.createRememberTable` 是否创建记住我表结构默认为`true`
|
||||
|
||||
|
||||
-1
@@ -13,7 +13,6 @@ public class BrowserProperties {
|
||||
/**
|
||||
* 用户自自定义的登录页面,不能为空
|
||||
*/
|
||||
@NotBlank
|
||||
private String html;
|
||||
|
||||
/**
|
||||
|
||||
+11
@@ -2,6 +2,7 @@ package com.micro.fast.security.core.master;
|
||||
|
||||
import com.micro.fast.security.core.browser.config.param.BrowserProperties;
|
||||
import com.micro.fast.security.core.validate.code.config.param.ValidateCodeProperties;
|
||||
import org.omg.CORBA.PRIVATE_MEMBER;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@@ -21,6 +22,16 @@ public class SecurityProperties {
|
||||
|
||||
private ValidateCodeProperties code = new ValidateCodeProperties();
|
||||
|
||||
private Boolean createRememberTable = true;
|
||||
|
||||
public Boolean getCreateRememberTable() {
|
||||
return createRememberTable;
|
||||
}
|
||||
|
||||
public void setCreateRememberTable(Boolean createRememberTable) {
|
||||
this.createRememberTable = createRememberTable;
|
||||
}
|
||||
|
||||
public BrowserProperties getBrowser() {
|
||||
return browser;
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ spring:
|
||||
password: studyj2e
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
redis:
|
||||
host: z3wg7.natappfree.cc/bim/
|
||||
host: z3wg7.natappfree.cc
|
||||
port: 6379
|
||||
#security:
|
||||
# basic:
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"dependencies": {
|
||||
"element-ui": "^2.0.8",
|
||||
"vue": "^2.5.2",
|
||||
"vue-resource": "^1.3.5",
|
||||
"vue-router": "^3.0.1",
|
||||
"vuex": "^3.0.1"
|
||||
},
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
<el-input v-model="imageCode" size="small" placeholder="验证码"></el-input>
|
||||
</el-col>
|
||||
<el-col :sm="3" :md="5" :lg="3" :xl="2">
|
||||
<image src="/code/image" class="image-code"></image>
|
||||
<img src="http://3z3wg7.natappfree.cc:10006/upms/code/image?width=67&height=30" class="image-code" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row type="flex" justify="center" class="row-line">
|
||||
<el-button type="success" size="medium" class="button-margin">登录</el-button>
|
||||
<el-button type="success" size="medium" class="button-margin" @click="signIn">登录</el-button>
|
||||
<el-button type="primary" size="medium">注册</el-button>
|
||||
</el-row>
|
||||
</el-main>
|
||||
@@ -38,6 +38,14 @@
|
||||
password: '',
|
||||
imageCode: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
signIn: function () {
|
||||
this.$http.post('http://3z3wg7.natappfree.cc:10008/user/login',this.data,{method: "post"})
|
||||
.then(response => {
|
||||
console.log(response.data)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -60,11 +68,9 @@
|
||||
margin-right: 70px;
|
||||
}
|
||||
.image-code {
|
||||
width: 67px;
|
||||
height: 23px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -5,8 +5,10 @@ import App from './App'
|
||||
import router from './router'
|
||||
import ElementUI from 'element-ui'
|
||||
import 'element-ui/lib/theme-chalk/index.css'
|
||||
import VueResource from 'vue-resource'
|
||||
|
||||
Vue.use(ElementUI)
|
||||
Vue.use(VueResource)
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ eureka:
|
||||
serviceUrl:
|
||||
defaultZone: http://micro:fast@www.register1.com:10002/eureka/,http://micro:fast@www.register2.com:10004/eureka/ #配置所有的注册中心
|
||||
instance:
|
||||
hostname: www.gateway.com
|
||||
hostname: 3z3wg7.natappfree.cc
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# 从配置中心加载文件
|
||||
spring:
|
||||
session:
|
||||
store-type: none
|
||||
cloud:
|
||||
config:
|
||||
profile: dev
|
||||
@@ -16,4 +18,12 @@ eureka:
|
||||
defaultZone: http://micro:fast@www.register1.com:10002/eureka/,http://micro:fast@www.register2.com:10004/eureka/ #配置所有的注册中心
|
||||
instance:
|
||||
hostname: www.upms.com
|
||||
ms:
|
||||
security:
|
||||
browser:
|
||||
loginType: JSON
|
||||
html: /
|
||||
createRememberTable: false
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user