Skip to content

Commit 99cf520

Browse files
committed
update readme
1 parent 455d5fe commit 99cf520

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

lab1/README.md

+20-7
Original file line numberDiff line numberDiff line change
@@ -559,13 +559,25 @@ application in project _library-server-complete-custom_.
559559

560560
#### Step 4: Add an additional JWT validator for the 'audience' claim
561561

562-
563562
Implementing an additional token validator is quite easy, you just have to implement the
564563
provided interface _OAuth2TokenValidator_.
565-
Validating the _audience_ claim of a token is strongly recommended by OAuth 2 & OIDC experts
566-
to avoid misusing access tokens for other resource servers. So we should also validate
567-
that only requests with access tokens containing the expected value of "library-service" in
568-
the _audience_ claim are successfully authenticated.
564+
565+
According to [OpenID Connect 1.0 specification](https://openid.net/specs/openid-connect-core-1_0.html#IDToken) the _audience_ claim
566+
is mandatory for ID tokens:
567+
568+
<blockquote cite=https://openid.net/specs/openid-connect-core-1_0.html#IDToken">
569+
Audience(s) that this ID Token is intended for. It MUST contain the OAuth 2.0 client_id of the Relying Party as an audience value. It MAY also contain identifiers for other audiences.
570+
</blockquote>
571+
572+
Despite of the fact that the _audience_ claim is not specified or mandatory for access tokens
573+
specifying and validating the _audience_ claim of access tokens is strongly recommended by OAuth 2 & OIDC experts
574+
to avoid misusing access tokens for other resource servers.
575+
There is also a new [draft specification](https://tools.ietf.org/html/draft-ietf-oauth-access-token-jwt)
576+
on the way to provide a standardized and interoperable profile as an alternative
577+
to the proprietary JWT access token layouts.
578+
579+
So we should also validate that only those requests bearing access tokens containing the
580+
expected value of "library-service" in the _audience_ claim are successfully authenticated.
569581

570582
So let's create a new class _AudienceValidator_ in package _com.example.library.server.security_
571583
with the following contents:
@@ -741,8 +753,9 @@ Now, with our previous changes this request should succeed with an '200' OK stat
741753

742754
<hr>
743755

744-
This ends part 1 of this lab. We continue with part 2 to replace the automatic mapping with our
745-
own custom mapping.
756+
This ends part 1 of this lab.
757+
We continue with [part 2](#lab-1---part-2) to have a closer look
758+
into a resource server just using the automatic mapping provided by Spring Security 5.
746759

747760
__<u>Important Note</u>__: If you could not manage to finish part 1 then just use the
748761
project __lab1/library-server-complete-custom__ for the next labs.

0 commit comments

Comments
 (0)