Using Test Doubles for Authentication
When we are using a shared language API like an OIDC/Oauth2 identity server, you can use a test-double that implements that API, but does not require real authentication.
This is can be super useful for testing one of - if not the most important parts of your application - authentication and authorization*.
For this test double, we will use a Docker container. (docker-compose.yml) using the https://github.com/navikt/mock-oauth2-server container.
yaml
services:
auth:
image: ghcr.io/navikt/mock-oauth2-server:2.1.10
ports:
- 9090:8080