Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
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
DEMO
spring-boot
Commits
cdb5d76c
Commit
cdb5d76c
authored
May 05, 2018
by
Madhura Bhave
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.0.x'
parents
e02954a2
469372c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
EndpointRequest.java
...tuate/autoconfigure/security/servlet/EndpointRequest.java
+17
-3
EndpointRequestTests.java
.../autoconfigure/security/servlet/EndpointRequestTests.java
+3
-3
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/EndpointRequest.java
View file @
cdb5d76c
...
...
@@ -198,7 +198,7 @@ public final class EndpointRequest {
if
(
this
.
includeLinks
&&
StringUtils
.
hasText
(
pathMappedEndpoints
.
getBasePath
()))
{
delegateMatchers
.
add
(
new
AntPathRequestMatcher
(
servletPath
+
pathMappedEndpoints
.
getBasePath
(
)));
computePath
(
servletPath
,
pathMappedEndpoints
.
getBasePath
()
)));
}
return
new
OrRequestMatcher
(
delegateMatchers
);
}
...
...
@@ -229,10 +229,17 @@ public final class EndpointRequest {
private
List
<
RequestMatcher
>
getDelegateMatchers
(
String
servletPath
,
Set
<
String
>
paths
)
{
return
paths
.
stream
()
.
map
((
path
)
->
new
AntPathRequestMatcher
(
servletPath
+
path
+
"/**"
))
.
map
((
path
)
->
new
AntPathRequestMatcher
(
computePath
(
servletPath
,
path
)
+
"/**"
))
.
collect
(
Collectors
.
toList
());
}
private
String
computePath
(
String
servletPath
,
String
path
)
{
if
(
servletPath
.
equals
(
"/"
))
{
return
path
;
}
return
servletPath
+
path
;
}
@Override
protected
boolean
matches
(
HttpServletRequest
request
,
Supplier
<
WebApplicationContext
>
context
)
{
...
...
@@ -272,11 +279,18 @@ public final class EndpointRequest {
private
RequestMatcher
createDelegate
(
String
path
,
WebEndpointProperties
properties
)
{
if
(
StringUtils
.
hasText
(
properties
.
getBasePath
()))
{
return
new
AntPathRequestMatcher
(
path
+
properties
.
getBasePath
(
));
return
new
AntPathRequestMatcher
(
computePath
(
path
,
properties
.
getBasePath
()
));
}
return
EMPTY_MATCHER
;
}
private
String
computePath
(
String
servletPath
,
String
path
)
{
if
(
servletPath
.
equals
(
"/"
))
{
return
path
;
}
return
servletPath
+
path
;
}
@Override
protected
boolean
matches
(
HttpServletRequest
request
,
Supplier
<
WebApplicationContext
>
context
)
{
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/EndpointRequestTests.java
View file @
cdb5d76c
...
...
@@ -52,9 +52,9 @@ public class EndpointRequestTests {
@Test
public
void
toAnyEndpointShouldMatchEndpointPath
()
{
RequestMatcher
matcher
=
EndpointRequest
.
toAnyEndpoint
();
assertMatcher
(
matcher
).
matches
(
"/actuator/foo"
);
assertMatcher
(
matcher
).
matches
(
"/actuator/bar"
);
assertMatcher
(
matcher
).
matches
(
"/actuator"
);
assertMatcher
(
matcher
,
"/actuator"
,
"/"
).
matches
(
"/actuator/foo"
);
assertMatcher
(
matcher
,
"/actuator"
,
"/"
).
matches
(
"/actuator/bar"
);
assertMatcher
(
matcher
,
"/actuator"
,
"/"
).
matches
(
"/actuator"
);
}
@Test
...
...
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