=== Switch off the Spring Boot security configuration
If you define a `@Configuration` with `@EnableWebSecurity` anywhere in your application
@ -1157,7 +1140,9 @@ use this in a webapp is to inject it into a void method in a
@@ -1157,7 +1140,9 @@ use this in a webapp is to inject it into a void method in a
}
----
You will get the best results if you put this in a nested class, or a standalone class (i.e.
not mixed in with a lot of other `@Beans` that might be allowed to influence the order of
instantiation). The https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-web-secure[secure web sample] is a useful template to follow.
@ -251,9 +251,9 @@ all non-sensitive endpoints to be exposed over HTTP. The default convention is t
@@ -251,9 +251,9 @@ all non-sensitive endpoints to be exposed over HTTP. The default convention is t
[[production-ready-sensitive-endpoints]]
=== Exposing sensitive endpoints
If you use ``Spring Security'' sensitive endpoints will also be exposed over HTTP. By
default ``basic'' authentication will be used with the username `user` and a generated
password.
If you use ``Spring Security'' sensitive endpoints will be exposed over HTTP, but also
protected. By default ``basic'' authentication will be used with the username `user`
and a generated password (which is printed on the console when the application starts).
TIP: Generated passwords are logged as the application starts. Search for ``Using default
@ -993,7 +993,66 @@ packaged as an executable archive), there are some limitations in the JSP suppor
@@ -993,7 +993,66 @@ packaged as an executable archive), there are some limitations in the JSP suppor
There is a {github-code}/spring-boot-samples/spring-boot-sample-web-jsp[JSP sample] so
you can see how to set things up.
[[boot-features-security]]
== Security
If Spring Security is on the classpath then web applications will be secure by default
with ``basic'' authentication on all HTTP endpoints. To add method-level security to a web
application you can also add `@EnableGlobalMethodSecurity` with your desired settings.
Additional information can be found in the {spring-security-reference}#jc-method[Spring
Security Reference].
The default `AuthenticationManager` has a single user (username
``user'' and password random, printed at INFO level when the
application starts up). You can change the password by providing a
`security.user.password`. This and other useful properties are