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
f6134a88
Commit
f6134a88
authored
Aug 28, 2017
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
31f8aeaf
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
30 additions
and
29 deletions
+30
-29
ManagementEndpointPathResolver.java
...utoconfigure/endpoint/ManagementEndpointPathResolver.java
+1
-0
SecurityAutoConfiguration.java
...oot/autoconfigure/security/SecurityAutoConfiguration.java
+2
-4
SecurityProperties.java
...ework/boot/autoconfigure/security/SecurityProperties.java
+0
-5
SpringBootSecurity.java
...ework/boot/autoconfigure/security/SpringBootSecurity.java
+17
-12
SpringBootWebSecurityConfiguration.java
...onfigure/security/SpringBootWebSecurityConfiguration.java
+4
-3
WebSecurityEnablerConfiguration.java
...toconfigure/security/WebSecurityEnablerConfiguration.java
+5
-4
DefaultEndpointPathResolver.java
...gframework/boot/endpoint/DefaultEndpointPathResolver.java
+1
-0
EndpointPathResolver.java
...g/springframework/boot/endpoint/EndpointPathResolver.java
+0
-1
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ManagementEndpointPathResolver.java
View file @
f6134a88
...
...
@@ -24,6 +24,7 @@ import org.springframework.boot.endpoint.EndpointPathResolver;
* actuator endpoint paths based on the endpoint id and management.context-path.
*
* @author Madhura Bhave
* @since 2.0.0
*/
public
class
ManagementEndpointPathResolver
implements
EndpointPathResolver
{
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfiguration.java
View file @
f6134a88
...
...
@@ -52,10 +52,8 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
@ConditionalOnClass
({
AuthenticationManager
.
class
,
GlobalAuthenticationConfigurerAdapter
.
class
})
@EnableConfigurationProperties
(
SecurityProperties
.
class
)
@Import
({
SpringBootWebSecurityConfiguration
.
class
,
WebSecurityEnablerConfiguration
.
class
,
AuthenticationManagerConfiguration
.
class
,
SecurityDataConfiguration
.
class
})
@Import
({
SpringBootWebSecurityConfiguration
.
class
,
WebSecurityEnablerConfiguration
.
class
,
AuthenticationManagerConfiguration
.
class
,
SecurityDataConfiguration
.
class
})
public
class
SecurityAutoConfiguration
{
@Bean
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java
View file @
f6134a88
...
...
@@ -108,11 +108,6 @@ public class SecurityProperties implements SecurityPrerequisite {
*/
private
boolean
enabled
=
true
;
/**
* Security authorize mode to apply.
*/
private
SecurityAuthorizeMode
authorizeMode
=
SecurityAuthorizeMode
.
ROLE
;
public
boolean
isEnabled
()
{
return
this
.
enabled
;
}
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootSecurity.java
View file @
f6134a88
...
...
@@ -33,11 +33,11 @@ import org.springframework.util.StringUtils;
/**
* Provides request matchers that can be used to
* configure security for static resources and the error controller path in a custom
* {@link WebSecurityConfigurerAdapter}.
* Provides request matchers that can be used to configure security for static resources
* and the error controller path in a custom {@link WebSecurityConfigurerAdapter}.
*
* @author Madhura Bhave
* @since 2.0.0
*/
public
final
class
SpringBootSecurity
{
...
...
@@ -46,14 +46,15 @@ public final class SpringBootSecurity {
*/
public
final
static
String
ALL_ENDPOINTS
=
"**"
;
private
static
String
[]
STATIC_RESOURCES
=
new
String
[]
{
"/css/**"
,
"/js/**"
,
"/images/**"
,
"/webjars/**"
,
"/**/favicon.ico"
};
private
static
String
[]
STATIC_RESOURCES
=
new
String
[]
{
"/css/**"
,
"/js/**"
,
"/images/**"
,
"/webjars/**"
,
"/**/favicon.ico"
};
private
final
EndpointPathResolver
endpointPathResolver
;
private
final
ErrorController
errorController
;
SpringBootSecurity
(
EndpointPathResolver
endpointPathResolver
,
ErrorController
errorController
)
{
SpringBootSecurity
(
EndpointPathResolver
endpointPathResolver
,
ErrorController
errorController
)
{
this
.
endpointPathResolver
=
endpointPathResolver
;
this
.
errorController
=
errorController
;
}
...
...
@@ -67,7 +68,8 @@ public final class SpringBootSecurity {
Assert
.
notEmpty
(
ids
,
"At least one endpoint id must be specified."
);
List
<
String
>
pathList
=
Arrays
.
asList
(
ids
);
if
(
pathList
.
contains
(
ALL_ENDPOINTS
))
{
return
new
AntPathRequestMatcher
(
this
.
endpointPathResolver
.
resolvePath
(
ALL_ENDPOINTS
),
null
);
return
new
AntPathRequestMatcher
(
this
.
endpointPathResolver
.
resolvePath
(
ALL_ENDPOINTS
),
null
);
}
return
getEndpointsRequestMatcher
(
pathList
);
}
...
...
@@ -84,7 +86,8 @@ public final class SpringBootSecurity {
if
(
e
.
isAnnotationPresent
(
Endpoint
.
class
))
{
return
e
.
getAnnotation
(
Endpoint
.
class
).
id
();
}
throw
new
IllegalArgumentException
(
"Only classes annotated with @Endpoint are supported."
);
throw
new
IllegalArgumentException
(
"Only classes annotated with @Endpoint are supported."
);
}).
collect
(
Collectors
.
toList
());
return
getEndpointsRequestMatcher
(
paths
);
}
...
...
@@ -104,7 +107,8 @@ public final class SpringBootSecurity {
*/
public
RequestMatcher
error
()
{
if
(
this
.
errorController
==
null
)
{
throw
new
IllegalStateException
(
"Path for error controller could not be determined."
);
throw
new
IllegalStateException
(
"Path for error controller could not be determined."
);
}
String
path
=
normalizePath
(
this
.
errorController
.
getErrorPath
());
return
new
AntPathRequestMatcher
(
path
+
"/**"
,
null
);
...
...
@@ -121,9 +125,9 @@ public final class SpringBootSecurity {
private
static
RequestMatcher
getRequestMatcher
(
String
...
paths
)
{
List
<
RequestMatcher
>
matchers
=
new
ArrayList
<>();
for
(
String
path
:
paths
)
{
matchers
.
add
(
new
AntPathRequestMatcher
(
path
,
null
));
}
for
(
String
path
:
paths
)
{
matchers
.
add
(
new
AntPathRequestMatcher
(
path
,
null
));
}
return
new
OrRequestMatcher
(
matchers
);
}
...
...
@@ -134,5 +138,6 @@ public final class SpringBootSecurity {
}
return
result
;
}
}
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java
View file @
f6134a88
...
...
@@ -30,11 +30,12 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
/**
* The default configuration for web security. It relies on Spring Security's
* content-negotiation strategy to determine what sort of authentication to use.
* If the user specifies their own {@link WebSecurityConfigurerAdapter}, this will
back-off
*
completely and the users should specify all the bits that they want to configure as part
* of the custom security configuration.
* If the user specifies their own {@link WebSecurityConfigurerAdapter}, this will
*
back-off completely and the users should specify all the bits that they want to
*
configure as part
of the custom security configuration.
*
* @author Madhura Bhave
* @since 2.0.0
*/
@ConditionalOnProperty
(
prefix
=
"security.basic"
,
name
=
"enabled"
,
havingValue
=
"true"
,
matchIfMissing
=
true
)
@ConditionalOnClass
(
EnableWebSecurity
.
class
)
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/WebSecurityEnablerConfiguration.java
View file @
f6134a88
...
...
@@ -25,12 +25,13 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
/**
* If there is a bean of type WebSecurityConfigurerAdapter,
*
this adds the {@code @EnableWebSecurity} annotation if it is not already specified.
*
This will make sure that the annotation is present with default security autoconfiguration
*
and also
if the user adds custom security and forgets to add the annotation.
* If there is a bean of type WebSecurityConfigurerAdapter,
this adds the
*
{@code @EnableWebSecurity} annotation if it is not already specified. This will make
*
sure that the annotation is present with default security auto-configuration and also
* if the user adds custom security and forgets to add the annotation.
*
* @author Madhura Bhave
* @since 2.0.0
*/
@ConditionalOnBean
(
WebSecurityConfigurerAdapter
.
class
)
@ConditionalOnClass
(
EnableWebSecurity
.
class
)
...
...
spring-boot/src/main/java/org/springframework/boot/endpoint/DefaultEndpointPathResolver.java
View file @
f6134a88
...
...
@@ -21,6 +21,7 @@ package org.springframework.boot.endpoint;
* resolving endpoint paths.
*
* @author Madhura Bhave
* @since 2.0.0
*/
public
class
DefaultEndpointPathResolver
implements
EndpointPathResolver
{
...
...
spring-boot/src/main/java/org/springframework/boot/endpoint/EndpointPathResolver.java
View file @
f6134a88
...
...
@@ -27,7 +27,6 @@ public interface EndpointPathResolver {
/**
* Resolve endpoint path based on id.
*
* @param endpointId the endpoint id
* @return the resolved path
*/
...
...
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