ch4mpy / spring-addons

Ease spring OAuth2 resource-servers configuration and testing
Apache License 2.0
521 stars 84 forks source link
auth0 cognito hacktoberfest keycloak oidc openid openidconnect spring-boot spring-security

Ease OAuth2 / OpenID Configuration & Tests in Spring Boot 3

Useful links

Breaking News

In 7.7.0, some @ConfigurationProperties were changed to inner-class definition (instead of standing in a source file of their own). Migration should be no more complicated than organizing imports.

The OAuth2 BFF tutorial is now on Baeldung. It was deeply refreshed in the process and now contains samples for Angular, React (Next.js) and Vue (Vite).

OIDC starter

With spring-addons-starter-oidc, you might need 0 Java conf, even in scenarios like:

Unit & Integration Testing With Security

Testing access control requires to configure the test security context. For that, spring-security-test provides with MockMvc request post-processors and WebTestClient mutators, but this can work only in the context of a request, which limits its usage to controllers.

To test any type of @Component (@Controller, off course, but also @Service and @Repository) there are only two options:

Useful resources: