Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-boot-admin
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-boot-admin
Commits
76afd073
Commit
76afd073
authored
Jul 25, 2018
by
赵天增
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
监控
parent
4aa9591c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
1 deletion
+51
-1
pom.xml
monitor-core/pom.xml
+9
-0
WebSecurityConfig.java
...main/java/com/medtap/monitor/admin/WebSecurityConfig.java
+35
-0
application.yml
monitor-core/src/main/resources/application.yml
+7
-1
No files found.
monitor-core/pom.xml
View file @
76afd073
...
@@ -30,6 +30,15 @@
...
@@ -30,6 +30,15 @@
<groupId>
org.springframework.cloud
</groupId>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-security
</artifactId>
</dependency>
<dependency>
<groupId>
de.codecentric
</groupId>
<artifactId>
spring-boot-admin-server-ui
</artifactId>
<version>
2.0.2-SNAPSHOT
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
<plugins>
<plugins>
...
...
monitor-core/src/main/java/com/medtap/monitor/admin/WebSecurityConfig.java
0 → 100644
View file @
76afd073
package
com
.
medtap
.
monitor
.
admin
;
import
de.codecentric.boot.admin.server.config.AdminServerProperties
;
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
;
@Configuration
public
class
WebSecurityConfig
extends
WebSecurityConfigurerAdapter
{
private
final
String
adminContextPath
;
public
WebSecurityConfig
(
AdminServerProperties
adminServerProperties
)
{
this
.
adminContextPath
=
adminServerProperties
.
getContextPath
();
}
@Override
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
// @formatter:off
SavedRequestAwareAuthenticationSuccessHandler
successHandler
=
new
SavedRequestAwareAuthenticationSuccessHandler
();
successHandler
.
setTargetUrlParameter
(
"redirectTo"
);
http
.
authorizeRequests
()
.
antMatchers
(
adminContextPath
+
"/assets/**"
).
permitAll
()
.
antMatchers
(
adminContextPath
+
"/login"
).
permitAll
()
.
anyRequest
().
authenticated
()
.
and
()
.
formLogin
().
loginPage
(
adminContextPath
+
"/login"
).
successHandler
(
successHandler
).
and
()
.
logout
().
logoutUrl
(
adminContextPath
+
"/logout"
).
and
()
.
httpBasic
().
and
()
.
csrf
().
disable
();
// @formatter:on
}
}
monitor-core/src/main/resources/application.yml
View file @
76afd073
...
@@ -2,6 +2,7 @@ eureka:
...
@@ -2,6 +2,7 @@ eureka:
instance
:
instance
:
leaseRenewalIntervalInSeconds
:
10
leaseRenewalIntervalInSeconds
:
10
health-check-url-path
:
/actuator/health
health-check-url-path
:
/actuator/health
instance-id
:
${spring.cloud.client.ip-address}:${server.port}
client
:
client
:
registryFetchIntervalSeconds
:
5
registryFetchIntervalSeconds
:
5
serviceUrl
:
serviceUrl
:
...
@@ -17,8 +18,11 @@ management:
...
@@ -17,8 +18,11 @@ management:
show-details
:
ALWAYS
show-details
:
ALWAYS
# 微服务列表,如果服务不存在会触发邮件提醒
# 微服务列表,如果服务不存在会触发邮件提醒
spring
:
spring
:
security
:
user
:
name
:
"
server-monitor"
password
:
"
2lvoHcfXbXmTBvQm"
boot
:
boot
:
admin
:
admin
:
notify
:
notify
:
...
@@ -66,4 +70,6 @@ spring:
...
@@ -66,4 +70,6 @@ spring:
YJY-PROVIDER-THIRD,
YJY-PROVIDER-THIRD,
YJY-PROVIDER-USER,
YJY-PROVIDER-USER,
YJY-SERVER-CONFIG
YJY-SERVER-CONFIG
application
:
name
:
monitor
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment