File tree Expand file tree Collapse file tree 3 files changed +80
-1
lines changed
nixos/modules/services/web-apps
development/python-modules/mozilla-django-oidc Expand file tree Collapse file tree 3 files changed +80
-1
lines changed Original file line number Diff line number Diff line change 1616 ln -s ${ configFile } $out/opt/peering-manager/peering_manager/configuration.py
1717 '' + lib . optionalString cfg . enableLdap ''
1818 ln -s ${ cfg . ldapConfigPath } $out/opt/peering-manager/peering_manager/ldap_config.py
19+ '' + lib . optionalString cfg . enableOidc ''
20+ ln -s ${ cfg . oidcConfigPath } $out/opt/peering-manager/peering_manager/oidc_config.py
1921 '' ;
2022 } ) ) . override {
2123 inherit ( cfg ) plugins ;
@@ -139,6 +141,24 @@ in {
139141 See the [documentation](https://peering-manager.readthedocs.io/en/stable/setup/6-ldap/#configuration) for possible options.
140142 '' ;
141143 } ;
144+
145+ enableOidc = mkOption {
146+ type = types . bool ;
147+ default = false ;
148+ description = ''
149+ Enable OIDC-Authentication for Peering Manager.
150+
151+ This requires a configuration file being pass through `oidcConfigPath`.
152+ '' ;
153+ } ;
154+
155+ oidcConfigPath = mkOption {
156+ type = types . path ;
157+ description = ''
158+ Path to the Configuration-File for OIDC-Authentication, will be loaded as `oidc_config.py`.
159+ See the [documentation](https://peering-manager.readthedocs.io/en/stable/setup/6b-oidc/#configuration) for possible options.
160+ '' ;
161+ } ;
142162 } ;
143163
144164 config = lib . mkIf cfg . enable {
@@ -173,7 +193,10 @@ in {
173193 PEERINGDB_API_KEY = file.readline()
174194 '' ;
175195
176- plugins = lib . mkIf cfg . enableLdap ( ps : [ ps . django-auth-ldap ] ) ;
196+ plugins = ( ps :
197+ ( lib . optionals cfg . enableLdap [ ps . django-auth-ldap ] ) ++
198+ ( lib . optionals cfg . enableOidc ( with ps ; [ mozilla-django-oidc pyopenssl josepy ] ) )
199+ ) ;
177200 } ;
178201
179202 system . build . peeringManagerPkg = pkg ;
Original file line number Diff line number Diff line change 1+ { lib
2+ , buildPythonPackage
3+ , fetchFromGitHub
4+ , setuptools
5+ , djangorestframework
6+ , django
7+ , josepy
8+ , requests
9+ , cryptography
10+ } :
11+
12+ buildPythonPackage rec {
13+ pname = "mozilla-django-oidc" ;
14+ version = "4.0.1" ;
15+ pyproject = true ;
16+
17+ src = fetchFromGitHub {
18+ owner = "mozilla" ;
19+ repo = "mozilla-django-oidc" ;
20+ rev = version ;
21+ hash = "sha256-72F1aLLIId+YClTrpOz3bL8LSq6ZhZjjtv8V/GJGkqs=" ;
22+ } ;
23+
24+ nativeBuildInputs = [
25+ setuptools
26+ ] ;
27+
28+ nativeCheckInputs = [
29+ djangorestframework
30+ ] ;
31+
32+ checkPhase = ''
33+ runHook preCheck
34+
35+ PYTHONPATH=.:$PYTHONPATH DJANGO_SETTINGS_MODULE=tests.settings django-admin test
36+
37+ runHook postCheck
38+ '' ;
39+
40+ dependencies = [
41+ django
42+ josepy
43+ requests
44+ cryptography
45+ ] ;
46+
47+ meta = {
48+ description = "Django OpenID Connect library" ;
49+ homepage = "https://github.com/mozilla/mozilla-django-oidc" ;
50+ changelog = "https://github.com/mozilla/mozilla-django-oidc/releases/tag/${ src . rev } " ;
51+ license = lib . licenses . mpl20 ;
52+ maintainers = with lib . maintainers ; [ felbinger ] ;
53+ } ;
54+ }
Original file line number Diff line number Diff line change @@ -7809,6 +7809,8 @@ self: super: with self; {
78097809
78107810 mox3 = callPackage ../development/python-modules/mox3 { };
78117811
7812+ mozilla-django-oidc = callPackage ../development/python-modules/mozilla-django-oidc { };
7813+
78127814 mpd2 = callPackage ../development/python-modules/mpd2 { };
78137815
78147816 mpegdash = callPackage ../development/python-modules/mpegdash { };
You can’t perform that action at this time.
0 commit comments