微服务监控中心springboot-凯发app官方网站
凯发app官方网站-凯发k8官网下载客户端中心
| |
凯发app官方网站-凯发k8官网下载客户端中心
4月28日14:30-20:30机房服务器迁移,暂停博客使用
9/30日 14:00 -10/4日 08:00暂时无法发布内容!
9/30日 14:00 -10/4日 08:00暂时无法发布内容!
| |
博客访问: 470973
博文数量: 298
博客积分: 0
博客等级: 民兵
技术积分: 3077
用 户 组: 普通用户
注册时间: 2019-06-17 10:57
文章分类
(298)
(298)
文章存档
(96)
(1)
(5)
(20)
(18)
(22)
(13)
(17)
(201)
(23)
(22)
(15)
(20)
(24)
(28)
(26)
(25)
(18)
(1)
(1)
我的朋友
最近访客
csspytho
丸喵喵
推荐博文
·
postgresql技术大讲堂 - 第16...
·
【服务器数据恢复】drobopro ...
·
用python实现机器学习算法。...
·
iotlb和ats
·
ffmpeg添加水印 c 代码实现...
相关博文
·
·
·
·
·
·
·
·
·
·
微服务监控中心springboot-admin 配置登录密码
分类:
java
2022-06-10 10:30:18
点击(
此处
)折叠或打开
1
.
pom 加入 security
<
!
-
-
加入密码认证
-
-
>
<
dependency
>
<
groupid
>
org
.
springframework
.
boot
<
/
groupid
>
<
artifactid
>
spring
-
boot
-
starter
-
security
<
/
artifactid
>
<
/
dependency
>
2
.
加入配置类 securitysecureconfig
package
org
.
fh
.
config
;
import
org
.
springframework
.
context
.
annotation
.
configuration
;
import
org
.
springframework
.
security
.
config
.
annotation
.
web
.
builders
.
httpsecurity
;
import
org
.
springframework
.
security
.
config
.
annotation
.
web
.
configuration
.
websecurityconfigureradapter
;
import
org
.
springframework
.
security
.
web
.
authentication
.
savedrequestawareauthenticationsuccesshandler
;
import de
.
codecentric
.
boot
.
admin
.
server
.
config
.
adminserverproperties
;
/
*
*
*
说明:securitysecure配置
*
作者:fh admin
*
from:fhadmin
.
cn
*
/
@configuration
public
class securitysecureconfig extends websecurityconfigureradapter {
private final string admincontextpath
;
public
securitysecureconfig
(
adminserverproperties adminserverproperties
)
{
this
.
admincontextpath
=
adminserverproperties
.
getcontextpath
(
)
;
}
@override
protected void configure
(
httpsecurity http
)
throws exception {
savedrequestawareauthenticationsuccesshandler successhandler
=
new savedrequestawareauthenticationsuccesshandler
(
)
;
successhandler
.
settargeturlparameter
(
"redirectto"
)
;
http
.
headers
(
)
.
frameoptions
(
)
.
disable
(
)
;
http
.
authorizerequests
(
)
.
antmatchers
(
admincontextpath
"/assets/**"
,
admincontextpath
"/actuator/**"
)
.
permitall
(
)
.
antmatchers
(
admincontextpath
"/login"
)
.
permitall
(
)
.
anyrequest
(
)
.
authenticated
(
)
.
and
(
)
.
formlogin
(
)
.
loginpage
(
admincontextpath
"/login"
)
.
successhandler
(
successhandler
)
.
and
(
)
.
logout
(
)
.
logouturl
(
admincontextpath
"/logout"
)
.
and
(
)
.
httpbasic
(
)
.
and
(
)
.
csrf
(
)
.
disable
(
)
;
}
}
3
.
配置 application
.
properties
#开启安全认证 用户名和密码
spring
.
security
.
user
.
name
=
fhadmin
spring
.
security
.
user
.
password
=
root
spring
.
security
.
basic
.
enabled
=
true
阅读(2532) | 评论(0) | 转发(0) |
0
上一篇:
下一篇:
给主人留下些什么吧!~~
评论热议
请登录后评论。
")); function link(t){ var href= $(t).attr('href'); href ="?url=" encodeuricomponent(location.href); $(t).attr('href',href); //setcookie("returnouturl", location.href, 60, "/"); }
网站地图