Alliance Auth OIDC Provider
Project description
allianceauth_oidc
Allianceauth OIDC Provider
Features
- OIDC / OAuth2
- Scopes Available
- openid
- profile
- Includes
groupsclaim with all a members groups and state as a list of strings
- Includes
- Scopes Available
- Application level permissions
- global access
- State access
- group access
Example
Setup/Install:
-
pip install allianceauth-oidc-provider -
add to INSTALLED_APPS
'allianceauth_oidc', 'oauth2_provider', -
Extra Settings Required
# at the top of the file
from pathlib import Path
# Add these to the file further down
OAUTH2_PROVIDER_APPLICATION_MODEL='allianceauth_oidc.AllianceAuthApplication'
OAUTH2_PROVIDER = {
"OIDC_ENABLED": True, # https://django-oauth-toolkit.readthedocs.io/en/stable/oidc.html#creating-rsa-private-key
"OIDC_RSA_PRIVATE_KEY": Path("/path/to/key/file").read_text(), ## Load your private key
"OAUTH2_VALIDATOR_CLASS": "allianceauth_oidc.auth_provider.AllianceAuthOAuth2Validator",
"SCOPES": {
"openid": "User Profile",
"email": "Registered email",
"profile": "Main Character affiliation and Auth groups"
},
"PKCE_REQUIRED": False,
"APPLICATION_ADMIN_CLASS": "allianceauth_oidc.admin.ApplicationAdmin",
'ACCESS_TOKEN_EXPIRE_SECONDS': 60,
'REFRESH_TOKEN_EXPIRE_SECONDS': 24*60*60,
'ROTATE_REFRESH_TOKEN': True,
}
Please see this for more info on creating and managing a private key
- Add the endpoints to your
urls.py
path('o/', include('allianceauth_oidc.urls', namespace='oauth2_provider')),
- run migrations
- restart auth
Application setup
The Big 4
- Authorization:
https://your.url/o/authorize/ - Token:
https://your.url/o/token/ - Profile:
https://your.url/o/userinfo/ - Issuer
https://your.url/o
Claims
openid profile email
Claim key mapping
nameEve Main Character Name ( Profile Grant? )emailRegistered email on auth ( Email Grant )groupsList of all groups with the members state thrown in too ( Profile Grant )subPK of user model
WikiJS
Manually create and groups you care for your users to have in the wiki and the service will map them for you. This greatly cuts down on group spam.
in auth create Administrators to give access to the full wiki admin site.
Administration > Authentication > Generic OpenID Connect / OAuth2
- Skip User Profile
off - Email claim
email - Display Name Claim
name - Map Groups
on - Groups Claim
groups - Allow Self Registration
on
Grafana
Tested only with access no group mapping as yet
Group>Team mapping requires Grafana cloud or Enterprise and is outside of the scope of this doc.
/etc/grafana/grafana.ini
[auth.generic_oauth]
enabled = true
name = Your Site Name
allow_sign_up = true
client_id = ******
client_secret = *****
scopes = openid,email,profile
empty_scopes = false
email_attribute_path = email
name_attribute_path = name
auth_url = https://your.url/o/authorize/
token_url = https://your.url/o/token/
api_url = https://your.url/o/userinfo/
Debugging an application
- Enable Debug Mode for the specific application in the auth admin site.
- then in your
gunicorn.loglook for long lines similar to this after you attempt to log in,
[01/Jan/2099 00:00:05] WARNING [allianceauth_oidc.signals:12] {"access_token": "abcdefghijklmnopqrstuvwxyz", "expires_in": 60, "token_type": "Bearer", "scope": "openid profile email", "refresh_token": "abcdefghijklmnopqrstuvwxyz", "id_token": "long ass string here"}
- take the
id_tokenfield and paste it into https://jwt.io/ to debug the data being sent to the application. it should be fairly self explanitory expect for these 2 fields.
issis the issuer that must match exactly in the applications own settings.subis your user id if you need to debug why user is being sent.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file allianceauth_oidc_provider-0.0.1b7.tar.gz.
File metadata
- Download URL: allianceauth_oidc_provider-0.0.1b7.tar.gz
- Upload date:
- Size: 26.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5479b1313a6227aea97eb53964ec9e0c33918b478c311ca3d91be6efa80c82f8
|
|
| MD5 |
bdc203481f1ee02d73de8e3725ae13e4
|
|
| BLAKE2b-256 |
9e504d6bbd27a6a61f7bc6c65b8b39894229a7d7cb39a52be3650593eb5bec90
|
File details
Details for the file allianceauth_oidc_provider-0.0.1b7-py2.py3-none-any.whl.
File metadata
- Download URL: allianceauth_oidc_provider-0.0.1b7-py2.py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dbba05c201408ddf24a6f4432322ebc36ded117ae8d9ade7e844106083e99b3
|
|
| MD5 |
440660169cdf92cb95905f4915dd6219
|
|
| BLAKE2b-256 |
22acf4314b52cedcf35d0266cdc46e865425c795da36cdf0bff23c7c61b38c44
|