← ClaudeAtlas

spring-oauth2-resource-serverlisted

Configure a Spring Boot app as an OAuth2 resource server that validates JWT access tokens against any OIDC provider (Keycloak, Auth0, Okta, Cognito, Entra ID). Sets up the security filter chain, JWT decoder with audience validation, CORS, config properties, and a slice test. Use when adding token-based API authentication to a Spring Boot service.
hcussi/claude-code-toolkit · ★ 0 · API & Backend · score 63
Install: claude install-skill hcussi/claude-code-toolkit
# spring-oauth2-resource-server Wire a Spring Boot application to accept and validate OAuth2/OIDC JWT access tokens (resource-server role). This covers protecting an API with bearer tokens. It does not configure the login/authorization-code flow (that is the client role) or opaque-token introspection. Provider-agnostic: it is driven entirely by an `issuer-uri`, so it works with Keycloak, Auth0, Okta, Cognito, Entra ID, or any OIDC-compliant authorization server. ## Before you start Discover the target project's shape rather than assuming it (use Glob/Grep): - **Build tool**: `build.gradle` / `build.gradle.kts` vs `pom.xml`, and whether Gradle uses a version catalog (`gradle/libs.versions.toml`). - **Spring Boot version**: read it from the build file. It changes two test imports (see `references/dependencies.md`). - **Base package**: the package under `src/main/java/...` holding the main `@SpringBootApplication` class. New classes go in a `config` subpackage of it. - **Config format**: `application.yml` vs `application.properties`. Then gather the values to plug in: - **issuer-uri**: the OIDC issuer base URL. - **audience**: the value expected in the token's `aud` claim (usually the API's client id / identifier). - **allowed CORS origins**: the browser origins that call this API. ## Steps Reference files live in this skill's `references/` directory. Copy them into the project, then substitute `com.example.app` with the real base package and adjust placeholders