You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/features/authentication/index.adoc
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,6 @@ Authentication is how we verify the identity of who is trying to access a partic
6
6
A common way to authenticate users is by requiring the user to enter a username and password.
7
7
Once authentication is performed we know the identity and can perform authorization.
8
8
9
-
Spring Security provides builtin support for authenticating users.
9
+
Spring Security provides built-in support for authenticating users.
10
10
This section is dedicated to generic authentication support that applies in both Servlet and WebFlux environments.
11
-
Refer to the sections on authentication for xref:servlet/authentication/index.adoc#servlet-authentication[Servlet] and WebFlux for details on what is supported for each stack.
11
+
See the sections on authentication for xref:servlet/authentication/index.adoc#servlet-authentication[Servlet] and WebFlux for details on what is supported for each stack.
All HTTPbased communication, including https://www.troyhunt.com/heres-why-your-static-website-needs-https/[static resources], should be protected https://cheatsheetseries.owasp.org/cheatsheets/Transport_Layer_Protection_Cheat_Sheet.html[using TLS].
4
+
All HTTP-based communication, including https://www.troyhunt.com/heres-why-your-static-website-needs-https/[static resources], should be protected by https://cheatsheetseries.owasp.org/cheatsheets/Transport_Layer_Protection_Cheat_Sheet.html[using TLS].
5
5
6
6
As a framework, Spring Security does not handle HTTP connections and thus does not provide support for HTTPS directly.
7
7
However, it does provide a number of features that help with HTTPS usage.
8
8
9
9
[[http-redirect]]
10
10
== Redirect to HTTPS
11
11
12
-
When a client uses HTTP, Spring Security can be configured to redirect to HTTPS both xref:servlet/exploits/http.adoc#servlet-http-redirect[Servlet] and xref:reactive/exploits/http.adoc#webflux-http-redirect[WebFlux] environments.
12
+
When a client uses HTTP, you can configure Spring Security to redirect to HTTPS in both xref:servlet/exploits/http.adoc#servlet-http-redirect[Servlet] and xref:reactive/exploits/http.adoc#webflux-http-redirect[WebFlux] environments.
13
13
14
14
[[http-hsts]]
15
15
== Strict Transport Security
@@ -19,14 +19,14 @@ Spring Security provides support for xref:features/exploits/headers.adoc#headers
19
19
[[http-proxy-server]]
20
20
== Proxy Server Configuration
21
21
22
-
When using a proxy server it is important to ensure that you have configured your application properly.
23
-
For example, many applications will have a load balancer that responds to request for https://example.com/ by forwarding the request to an application server at https://192.168.1:8080.
24
-
Without proper configuration, the application server will not know that the load balancer exists and treat the request as though https://192.168.1:8080 was requested by the client.
22
+
When using a proxy server, it is important to ensure that you have configured your application properly.
23
+
For example, many applications have a load balancer that responds to request for https://example.com/ by forwarding the request to an application server at https://192.168.1:8080
24
+
Without proper configuration, the application server can not know that the load balancer exists and treats the request as though https://192.168.1:8080 was requested by the client.
25
25
26
-
To fix this you can use https://tools.ietf.org/html/rfc7239[RFC 7239] to specify that a load balancer is being used.
27
-
To make the application aware of this, you need to either configure your application server aware of the X-Forwarded headers.
28
-
For example Tomcat uses the https://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/catalina/valves/RemoteIpValve.html[RemoteIpValve] and Jetty uses https://www.eclipse.org/jetty/javadoc/jetty-9/org/eclipse/jetty/server/ForwardedRequestCustomizer.html[ForwardedRequestCustomizer].
29
-
Alternatively, Spring users can leverage https://github.com/spring-projects/spring-framework/blob/v4.3.3.RELEASE/spring-web/src/main/java/org/springframework/web/filter/ForwardedHeaderFilter.java[ForwardedHeaderFilter].
26
+
To fix this, you can use https://tools.ietf.org/html/rfc7239[RFC 7239] to specify that a load balancer is being used.
27
+
To make the application aware of this, you need to configure your application server to be aware of the X-Forwarded headers.
28
+
For example, Tomcat uses https://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/catalina/valves/RemoteIpValve.html[`RemoteIpValve`] and Jetty uses https://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/server/ForwardedRequestCustomizer.html[`ForwardedRequestCustomizer`].
29
+
Alternatively, Spring users can use https://github.com/spring-projects/spring-framework/blob/v4.3.3.RELEASE/spring-web/src/main/java/org/springframework/web/filter/ForwardedHeaderFilter.java[`ForwardedHeaderFilter`].
30
30
31
-
Spring Boot users may use the `server.use-forward-headers` property to configure the application.
31
+
Spring Boot users can use the `server.use-forward-headers` property to configure the application.
32
32
See the https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-use-tomcat-behind-a-proxy-server[Spring Boot documentation] for further details.
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/features/integrations/cryptography.adoc
+45-38Lines changed: 45 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,26 @@
1
1
[[crypto]]
2
2
= Spring Security Crypto Module
3
3
4
-
5
4
[[spring-security-crypto-introduction]]
6
-
== Introduction
7
5
The Spring Security Crypto module provides support for symmetric encryption, key generation, and password encoding.
8
6
The code is distributed as part of the core module but has no dependencies on any other Spring Security (or Spring) code.
9
7
10
8
11
9
[[spring-security-crypto-encryption]]
12
10
== Encryptors
13
-
The Encryptors class provides factory methods for constructing symmetric encryptors.
14
-
Using this class, you can create ByteEncryptors to encrypt data in raw byte[] form.
15
-
You can also construct TextEncryptors to encrypt text strings.
11
+
The {security-api-url}org/springframework/security/crypto/encrypt/Encryptors.html[`Encryptors`] class provides factory methods for constructing symmetric encryptors.
12
+
This class lets you create {security-api-url}org/springframework/security/crypto/encrypt/BytesEncryptor.html[`BytesEncryptor`] instances to encrypt data in raw `byte[]` form.
13
+
You can also construct {security-api-url}org/springframework/security/crypto/encrypt/TextEncryptor.html[TextEncryptor] instances to encrypt text strings.
16
14
Encryptors are thread-safe.
17
15
16
+
[NOTE]
17
+
====
18
+
Both `BytesEncryptor` and `TextEncryptor` are interfaces. `BytesEncryptor` has multiple implementations.
19
+
====
20
+
18
21
[[spring-security-crypto-encryption-bytes]]
19
22
=== BytesEncryptor
20
-
Use the `Encryptors.stronger` factory method to construct a BytesEncryptor:
23
+
You can use the `Encryptors.stronger` factory method to construct a `BytesEncryptor`:
The difference between a queryable TextEncryptor and a standard TextEncryptor has to do with initialization vector (iv) handling.
108
-
The iv used in a queryable TextEncryptor#encrypt operation is shared, or constant, and is not randomly generated.
109
-
This means the same text encrypted multiple times will always produce the same encryption result.
110
-
This is less secure, but necessary for encrypted data that needs to be queried against.
111
-
An example of queryable encrypted text would be an OAuth apiKey.
110
+
The difference between a queryable `TextEncryptor` and a standard `TextEncryptor` has to do with initialization vector (IV) handling.
111
+
The IV used in a queryable `TextEncryptor.encrypt` operation is shared, or constant, and is not randomly generated.
112
+
This means the same text encrypted multiple times always produces the same encryption result.
113
+
This is less secure but necessary for encrypted data that needs to be queried against.
114
+
An example of queryable encrypted text would be an OAuth `apiKey`.
112
115
113
116
[[spring-security-crypto-keygenerators]]
114
117
== Key Generators
115
-
The KeyGenerators class provides a number of convenience factory methods for constructing different types of key generators.
116
-
Using this class, you can create a BytesKeyGenerator to generate byte[] keys.
117
-
You can also construct a StringKeyGenerator to generate string keys.
118
-
KeyGenerators are thread-safe.
118
+
The {security-api-url}org/springframework/security/crypto/keygen/KeyGenerators.html[`KeyGenerators`] class provides a number of convenience factory methods for constructing different types of key generators.
119
+
By using this class, you can create a {security-api-url}org/springframework/security/crypto/keygen/BytesKeyGenerator.html[`BytesKeyGenerator`] to generate `byte[]` keys.
120
+
You can also construct a {security-api-url}org/springframework/security/crypto/keygen/StringKeyGenerator.html`[StringKeyGenerator]` to generate string keys.
121
+
`KeyGenerators` is a thread-safe class.
119
122
120
123
=== BytesKeyGenerator
121
-
Use the KeyGenerators.secureRandom factory methods to generate a BytesKeyGenerator backed by a SecureRandom instance:
124
+
You can use the `KeyGenerators.secureRandom` factory methods to generate a `BytesKeyGenerator` backed by a `SecureRandom` instance:
122
125
123
126
.BytesKeyGenerator
124
127
====
@@ -138,7 +141,7 @@ val key = generator.generateKey()
138
141
====
139
142
140
143
The default key length is 8 bytes.
141
-
There is also a KeyGenerators.secureRandom variant that provides control over the key length:
144
+
A `KeyGenerators.secureRandom` variant provides control over the key length:
The `Pbkdf2PasswordEncoder` implementation uses PBKDF2 algorithm to hash the passwords.
242
-
In order to defeat password cracking PBKDF2 is a deliberately slow algorithm and should be tuned to take about .5 seconds to verify a password on your system.
248
+
To defeat password cracking, PBKDF2 is a deliberately slow algorithm and should be tuned to take about .5 seconds to verify a password on your system.
249
+
The following system uses the `Pbkdf2PasswordEncoder`:
0 commit comments