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: README.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,19 +7,19 @@ This project provides a server-side example of Approov token verification for a
7
7
-`/token-binding` - requires a valid Approov token which is bound to a header value.
8
8
-`/token-double-binding` - requires a valid Approov token which is bound to two header values.
9
9
10
-
In this example, Approov token check is implemented in `ApproovApplication.java`. The `ApproovTokenVerifier` filter is registered in Spring Security by the [SecurityConfig.securityFilterChain](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L188-L217). The responsibilities break down as follows:
10
+
In this example, Approov token check is implemented in `ApproovApplication.java`. The `ApproovTokenVerifier` filter is registered in Spring Security by the [SecurityConfig.securityFilterChain](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L205-L224). The responsibilities break down as follows:
11
11
12
-
1.**JWT Approov Token validation (signature + expiry)** is handled by [verifyApproovToken](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L291-L298) and [validateExpiration](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L340-L348). It verifies the HMAC (HS256) signature and rejects tokens that are missing or past `exp`.
12
+
1.**JWT Approov Token validation (signature + expiry)** is handled by [verifyApproovToken](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L324-L331) and [validateExpiration](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L477-L484). It parses signed claims with the HMAC key and rejects tokens that are missing or past `exp`.
13
13
14
-
2.**Token binding (pay + hash)** is implemented by [isBindingValid + hashBase64Url](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L316-L333). It computes `base64(sha256(binding_value))` and compares it to `pay`.
14
+
2.**Token binding (pay + hash)** is implemented by [isBindingValid + hashBase64](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L451-L469). It computes `base64(sha256(binding_value))` using standard Base64 and compares it to `pay`.
15
15
16
-
3.**Middleware enforcement** is done by [doFilterInternal](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L243-L289). Requests without valid token/binding are rejected with 401.
16
+
3.**Middleware enforcement** is done by [doFilterInternal](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L252-L302). Requests without a valid token or binding are rejected with `401`.
17
17
18
-
4.**Binding value selection (what gets hashed)** is in [extractBindingValue](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L304-L314). It uses `Authorization` for single binding, or `Authorization` + `SessionId` for double binding.
18
+
4.**Binding value selection (what gets hashed)** is in [bindingHeadersForPath](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L333-L340) and [extractBindingValue](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L436-L449). It uses `Authorization` for single binding, or `Authorization` + `SessionId` for double binding, and concatenates header values in order.
19
19
20
-
5.**Protected route requirements** are defined by [APPROOV_PROTECTED_PATHS](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L227-L229) and [needsBindingCheck](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L300-L302).
20
+
5.**Protected route requirements** are defined by [APPROOV_PROTECTED_PATHS](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L235-L238) and enforced by [shouldNotFilter](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L245-L248). Binding checks are applied only when `bindingHeadersForPath` returns headers and token binding is enabled in [doFilterInternal](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L276-L286).
21
21
22
-
6.**Protected routes are registered** in [ApproovController](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L147-L170).
22
+
6.**Protected routes are registered** in [ApproovController](https://github.com/approov/quickstart-java-spring-token-check/blob/refactor/spring-quickstart/src/main/java/io/approov/ApproovApplication.java#L111-L178).
0 commit comments