liveBook · Manning

Public key set

As explained in Spring Security in Action, Second Edition

A public key set is a collection of public cryptographic keys available for verifying digital signatures.

A public key set is a collection of public cryptographic keys that a resource server retrieves from an authorization server to verify JWT access-token signatures. The authorization server keeps the corresponding private keys for signing tokens. section 15.1

Figure 15.2 The resource server retrieves a set of public keys from the authorization server through an endpoint made available by the authorization server. The resource server then uses these keys to verify the signature of the access token.

The resource server obtains the key set through an authorization-server endpoint, then uses the keys to verify access-token signatures. section 15.1

Configure a Spring resource server

Expose the authorization server's jwks_uri, such as http://localhost:8080/oauth2/jwks, as a property and configure Spring Security with oauth2ResourceServer().jwt().jwkSetUri(keySetUri). Add authorization rules so requests require authentication, then test a protected endpoint with a bearer token. section 15.1

How Spring Security in Action, Second Edition covers it

How deep it goes
Explains endpoint discovery, public/private key roles, Spring configuration, authorization rules, and token testing.
Examples
Uses a jwks_uri endpoint, Spring Security configuration, a protected /demo endpoint, and curl bearer-token requests.
What it assumes
Assumes basic Spring and Java configuration, and requires an authorization server that exposes a public key set endpoint.
What you can do after
Configure and test JWT signature validation through a Spring OAuth2 resource server.
How it connects
Connects authorization servers, resource servers, JWTs, access tokens, digital signatures, and OpenID Connect metadata.

This explainer was generated by Manning's knowledge graph from the text of Spring Security in Action, Second Edition. The section links point to the parts of the book it draws on.