Dockerized setup for `mozilla-django-oidc` local dev and testing
Перейти к файлу
dependabot[bot] 9ad18af9ac Bump django from 3.2.25 to 4.2.16 in /testrp
Bumps [django](https://github.com/django/django) from 3.2.25 to 4.2.16.
- [Commits](https://github.com/django/django/compare/3.2.25...4.2.16)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-29 14:18:55 -04:00
.circleci
dockerfiles Update Python versions to latest patch in Docker images 2024-10-29 13:21:41 -04:00
testprovider Bump django from 3.2.25 to 4.2.16 in /testprovider 2024-10-29 13:30:18 -04:00
testrp Bump django from 3.2.25 to 4.2.16 in /testrp 2024-10-29 14:18:55 -04:00
.gitignore
CODE_OF_CONDUCT.md
HISTORY.md Prep for v0.10.10 release 2024-10-29 14:09:38 -04:00
LICENSE
Makefile
README.md Update Python versions to latest patch in Docker images 2024-10-29 13:21:41 -04:00

README.md

docker-test-mozilla-django-oidc

The purpose of these docker images is to setup a local environment to develop and test mozilla-django-oidc.

oidc-testprovider

https://hub.docker.com/r/mozilla/oidc-testprovider/tags?name=testprovider

  • Provides a docker image for an OIDC OP with preconfigured OIDC client IDs and secrets
  • OIDC provider endpoint is exposed in port 8080
  • Provides a Django management command for creating users
  • Uses django-oidc-provider
  • Great for local development environments!

Usage

In order for this setup to work testprovider, testrp hostnames should resolve to the IP of the docker image (for local development it's 127.0.0.1).

You can add the resolution to your /etc/hosts file.

You can also use nip.io. For example, if you name the service "oidcprovider", then you could have these three variables:

OIDC_OP_AUTHORIZATION_ENDPOINT=http://oidcprovider.127.0.0.1.nip.io:8080/openid/authorize
OIDC_OP_TOKEN_ENDPOINT=http://oidcprovider.127.0.0.1.nip.io:8080/openid/token
OIDC_OP_USER_ENDPOINT=http://oidcprovider.127.0.0.1.nip.io:8080/openid/userinfo

Example setup

docker-compose.yml

version: '3'
services:
  testprovider:
    image: mozilla/oidc-testprovider:oidc_testprovider-v0.10.9
    ports:
      - "8080:8080"

Creating users in the container

The testprovider image has a Django management command for creating users in the OIDC provider. This lets you create users on the command line.

With an already running testprovider container run:

docker-compose exec testprovider manage.py createuser USERNAME PASSWORD EMAIL

oidc_e2e_setup_py*

https://hub.docker.com/r/mozilla/oidc-testprovider/tags?name=e2e&page=1

These images are used for the end-to-end testing for mozilla-django-oidc.

We will maintain an image for each supported Python version. Currently, that's:

  • Python 3.7
  • Python 3.8
  • Python 3.9
  • Python 3.10

Other images generated by this project

All images are pushed to: https://hub.docker.com/r/mozilla/oidc-testprovider

  • oidc_testrunner
  • oidc_testrp_py3
    • Test django project preconfigured to work with testprovider
    • Uses mozilla-django-oidc as an authentication backend
    • Test RP is exposed in port 8081
    • Environment variables
      • TEST_OIDC_ALGO={hs,rs}

Example setup for oidc_testrp

docker-compose.yml

version: '3'
services:
  testrp:
    image: mozilla/oidc-testprovider:oidc_testrp_py3-v0.10.9
    ports:
      - "8081:8081"
    environment:
      - TEST_OIDC_ALGO=hs

Development

We use make to automate the docker image workflow.

For more info run make help.

Pushing a tag to GitHub will trigger building images and uploading them to Dockerhub.