Token VerificationΒΆ
The steps required to securely validate a JWS Token (like ID Token):
- Extract the key information from the JWS Token header:
kid,alg - Retrieve all JWK entries that BankID exposes from the JWKs endpoint.
- Keys used for signing can be filtered by the use attribute on each JWK. This value should be
sig. - Find the key used to sign the JWS Token by matching the
kidandalgfrom (1) with the JWK entries. - Extract the public key and certificate chain (
x5c) from the JWK entry. - Validate the origin of the key by verifying it's complete certificate chain (
x5c) with our published root certificate. - Validate the JWS token using the key.
Note
Using a secure and community provided library to validate JWS tokens is highly recommended.