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
36c7602f
Commit
36c7602f
authored
May 09, 2018
by
Madhura Bhave
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.0.x'
parents
bdfcb0dc
4ec87956
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
8 deletions
+32
-8
EndpointRequest.java
...uate/autoconfigure/security/reactive/EndpointRequest.java
+2
-2
EndpointRequest.java
...tuate/autoconfigure/security/servlet/EndpointRequest.java
+2
-2
EndpointRequestTests.java
...autoconfigure/security/reactive/EndpointRequestTests.java
+14
-2
EndpointRequestTests.java
.../autoconfigure/security/servlet/EndpointRequestTests.java
+14
-2
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/EndpointRequest.java
View file @
36c7602f
...
@@ -34,7 +34,7 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointPr
...
@@ -34,7 +34,7 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointPr
import
org.springframework.boot.actuate.endpoint.annotation.Endpoint
;
import
org.springframework.boot.actuate.endpoint.annotation.Endpoint
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints
;
import
org.springframework.boot.security.reactive.ApplicationContextServerWebExchangeMatcher
;
import
org.springframework.boot.security.reactive.ApplicationContextServerWebExchangeMatcher
;
import
org.springframework.core.annotation.Annotat
ion
Utils
;
import
org.springframework.core.annotation.Annotat
edElement
Utils
;
import
org.springframework.security.web.server.util.matcher.OrServerWebExchangeMatcher
;
import
org.springframework.security.web.server.util.matcher.OrServerWebExchangeMatcher
;
import
org.springframework.security.web.server.util.matcher.PathPatternParserServerWebExchangeMatcher
;
import
org.springframework.security.web.server.util.matcher.PathPatternParserServerWebExchangeMatcher
;
import
org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher
;
import
org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher
;
...
@@ -219,7 +219,7 @@ public final class EndpointRequest {
...
@@ -219,7 +219,7 @@ public final class EndpointRequest {
}
}
private
String
getEndpointId
(
Class
<?>
source
)
{
private
String
getEndpointId
(
Class
<?>
source
)
{
Endpoint
annotation
=
Annotat
ionUtils
.
fin
dAnnotation
(
source
,
Endpoint
.
class
);
Endpoint
annotation
=
Annotat
edElementUtils
.
getMerge
dAnnotation
(
source
,
Endpoint
.
class
);
Assert
.
state
(
annotation
!=
null
,
Assert
.
state
(
annotation
!=
null
,
()
->
"Class "
+
source
+
" is not annotated with @Endpoint"
);
()
->
"Class "
+
source
+
" is not annotated with @Endpoint"
);
return
annotation
.
id
();
return
annotation
.
id
();
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/EndpointRequest.java
View file @
36c7602f
...
@@ -35,7 +35,7 @@ import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
...
@@ -35,7 +35,7 @@ import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints
;
import
org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPathProvider
;
import
org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPathProvider
;
import
org.springframework.boot.security.servlet.ApplicationContextRequestMatcher
;
import
org.springframework.boot.security.servlet.ApplicationContextRequestMatcher
;
import
org.springframework.core.annotation.Annotat
ion
Utils
;
import
org.springframework.core.annotation.Annotat
edElement
Utils
;
import
org.springframework.security.web.util.matcher.AntPathRequestMatcher
;
import
org.springframework.security.web.util.matcher.AntPathRequestMatcher
;
import
org.springframework.security.web.util.matcher.OrRequestMatcher
;
import
org.springframework.security.web.util.matcher.OrRequestMatcher
;
import
org.springframework.security.web.util.matcher.RequestMatcher
;
import
org.springframework.security.web.util.matcher.RequestMatcher
;
...
@@ -238,7 +238,7 @@ public final class EndpointRequest {
...
@@ -238,7 +238,7 @@ public final class EndpointRequest {
}
}
private
String
getEndpointId
(
Class
<?>
source
)
{
private
String
getEndpointId
(
Class
<?>
source
)
{
Endpoint
annotation
=
Annotat
ionUtils
.
fin
dAnnotation
(
source
,
Endpoint
.
class
);
Endpoint
annotation
=
Annotat
edElementUtils
.
getMerge
dAnnotation
(
source
,
Endpoint
.
class
);
Assert
.
state
(
annotation
!=
null
,
Assert
.
state
(
annotation
!=
null
,
()
->
"Class "
+
source
+
" is not annotated with @Endpoint"
);
()
->
"Class "
+
source
+
" is not annotated with @Endpoint"
);
return
annotation
.
id
();
return
annotation
.
id
();
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/reactive/EndpointRequestTests.java
View file @
36c7602f
...
@@ -28,6 +28,7 @@ import org.springframework.boot.actuate.endpoint.Operation;
...
@@ -28,6 +28,7 @@ import org.springframework.boot.actuate.endpoint.Operation;
import
org.springframework.boot.actuate.endpoint.annotation.Endpoint
;
import
org.springframework.boot.actuate.endpoint.annotation.Endpoint
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoint
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoint
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints
;
import
org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint
;
import
org.springframework.context.support.StaticApplicationContext
;
import
org.springframework.context.support.StaticApplicationContext
;
import
org.springframework.http.server.reactive.ServerHttpRequest
;
import
org.springframework.http.server.reactive.ServerHttpRequest
;
import
org.springframework.http.server.reactive.ServerHttpResponse
;
import
org.springframework.http.server.reactive.ServerHttpResponse
;
...
@@ -117,8 +118,14 @@ public class EndpointRequestTests {
...
@@ -117,8 +118,14 @@ public class EndpointRequestTests {
@Test
@Test
public
void
excludeByClassShouldNotMatchExcluded
()
{
public
void
excludeByClassShouldNotMatchExcluded
()
{
ServerWebExchangeMatcher
matcher
=
EndpointRequest
.
toAnyEndpoint
()
ServerWebExchangeMatcher
matcher
=
EndpointRequest
.
toAnyEndpoint
()
.
excluding
(
FooEndpoint
.
class
);
.
excluding
(
FooEndpoint
.
class
,
BazServletEndpoint
.
class
);
assertMatcher
(
matcher
).
doesNotMatch
(
"/actuator/foo"
);
List
<
ExposableEndpoint
<?>>
endpoints
=
new
ArrayList
<>();
endpoints
.
add
(
mockEndpoint
(
"foo"
,
"foo"
));
endpoints
.
add
(
mockEndpoint
(
"bar"
,
"bar"
));
endpoints
.
add
(
mockEndpoint
(
"baz"
,
"baz"
));
PathMappedEndpoints
pathMappedEndpoints
=
new
PathMappedEndpoints
(
"/actuator"
,
()
->
endpoints
);
assertMatcher
(
matcher
,
pathMappedEndpoints
).
doesNotMatch
(
"/actuator/foo"
);
assertMatcher
(
matcher
,
pathMappedEndpoints
).
doesNotMatch
(
"/actuator/baz"
);
assertMatcher
(
matcher
).
matches
(
"/actuator/bar"
);
assertMatcher
(
matcher
).
matches
(
"/actuator/bar"
);
assertMatcher
(
matcher
).
matches
(
"/actuator"
);
assertMatcher
(
matcher
).
matches
(
"/actuator"
);
}
}
...
@@ -280,6 +287,11 @@ public class EndpointRequestTests {
...
@@ -280,6 +287,11 @@ public class EndpointRequestTests {
}
}
@ServletEndpoint
(
id
=
"baz"
)
private
static
class
BazServletEndpoint
{
}
interface
TestEndpoint
extends
ExposableEndpoint
<
Operation
>,
PathMappedEndpoint
{
interface
TestEndpoint
extends
ExposableEndpoint
<
Operation
>,
PathMappedEndpoint
{
}
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/EndpointRequestTests.java
View file @
36c7602f
...
@@ -30,6 +30,7 @@ import org.springframework.boot.actuate.endpoint.Operation;
...
@@ -30,6 +30,7 @@ import org.springframework.boot.actuate.endpoint.Operation;
import
org.springframework.boot.actuate.endpoint.annotation.Endpoint
;
import
org.springframework.boot.actuate.endpoint.annotation.Endpoint
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoint
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoint
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints
;
import
org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint
;
import
org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPathProvider
;
import
org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPathProvider
;
import
org.springframework.mock.web.MockHttpServletRequest
;
import
org.springframework.mock.web.MockHttpServletRequest
;
import
org.springframework.mock.web.MockServletContext
;
import
org.springframework.mock.web.MockServletContext
;
...
@@ -139,8 +140,14 @@ public class EndpointRequestTests {
...
@@ -139,8 +140,14 @@ public class EndpointRequestTests {
@Test
@Test
public
void
excludeByClassShouldNotMatchExcluded
()
{
public
void
excludeByClassShouldNotMatchExcluded
()
{
RequestMatcher
matcher
=
EndpointRequest
.
toAnyEndpoint
()
RequestMatcher
matcher
=
EndpointRequest
.
toAnyEndpoint
()
.
excluding
(
FooEndpoint
.
class
);
.
excluding
(
FooEndpoint
.
class
,
BazServletEndpoint
.
class
);
assertMatcher
(
matcher
).
doesNotMatch
(
"/actuator/foo"
);
List
<
ExposableEndpoint
<?>>
endpoints
=
new
ArrayList
<>();
endpoints
.
add
(
mockEndpoint
(
"foo"
,
"foo"
));
endpoints
.
add
(
mockEndpoint
(
"bar"
,
"bar"
));
endpoints
.
add
(
mockEndpoint
(
"baz"
,
"baz"
));
PathMappedEndpoints
pathMappedEndpoints
=
new
PathMappedEndpoints
(
"/actuator"
,
()
->
endpoints
);
assertMatcher
(
matcher
,
pathMappedEndpoints
).
doesNotMatch
(
"/actuator/foo"
);
assertMatcher
(
matcher
,
pathMappedEndpoints
).
doesNotMatch
(
"/actuator/baz"
);
assertMatcher
(
matcher
).
matches
(
"/actuator/bar"
);
assertMatcher
(
matcher
).
matches
(
"/actuator/bar"
);
assertMatcher
(
matcher
).
matches
(
"/actuator"
);
assertMatcher
(
matcher
).
matches
(
"/actuator"
);
}
}
...
@@ -311,6 +318,11 @@ public class EndpointRequestTests {
...
@@ -311,6 +318,11 @@ public class EndpointRequestTests {
}
}
@ServletEndpoint
(
id
=
"baz"
)
private
static
class
BazServletEndpoint
{
}
interface
TestEndpoint
extends
ExposableEndpoint
<
Operation
>,
PathMappedEndpoint
{
interface
TestEndpoint
extends
ExposableEndpoint
<
Operation
>,
PathMappedEndpoint
{
}
}
...
...
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