-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
116 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
.. _react-frontend: | ||
|
||
============== | ||
REACT Frontend | ||
============== | ||
|
||
Settings | ||
======== | ||
|
||
Base the settings file on ``argus.spa.settings``. The individual settings are | ||
in ``argus.spa.spa_settings``, note especially that :setting:`ROOT_URLCONF` is set | ||
to ``argus.spa.urls``. If you prefer to make your own root ``urls.py``, the | ||
frontend-specific urls can be imported from ``argus.spa.spa_urls``. | ||
|
||
Domain settings | ||
--------------- | ||
|
||
.. setting:: ARGUS_COOKIE_DOMAIN | ||
|
||
* :setting:`ARGUS_COOKIE_DOMAIN` holds the domain of the Argus instance. This is the domain | ||
that the cookie is set for. It is needed to log into the frontend. | ||
|
||
.. setting:: ARGUS_FRONTEND_URL | ||
|
||
* :setting:`ARGUS_FRONTEND_URL` is used for redirecting back to frontend after logging in | ||
through Feide and CORS. Must either be a subdomain of or the same as | ||
:setting:`ARGUS_COOKIE_DOMAIN`. | ||
|
||
In production, Argus requires the frontend and the backend to either be | ||
deployed on the same domain, or the frontend to be on a subdomain of the | ||
:setting:`ARGUS_COOKIE_DOMAIN`. When running Argus on localhost for development | ||
and testing, :setting:`ARGUS_COOKIE_DOMAIN` can be empty (and will default to | ||
localhost). | ||
|
||
Dataporten via OAuth2 | ||
--------------------- | ||
|
||
.. setting:: ARGUS_DATAPORTEN_KEY | ||
|
||
* :setting:`ARGUS_DATAPORTEN_KEY` holds the id/key for using dataporten for authentication. | ||
|
||
.. setting:: ARGUS_DATAPORTEN_SECRET | ||
|
||
* :setting:`ARGUS_DATAPORTEN_SECRET` holds the dataporten password. | ||
|
||
Refer to the section :ref:`dataporten <dataporten-reference>` for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,3 @@ | ||
from argus.site.settings import get_str_env | ||
from argus.site.settings.backend import * | ||
|
||
FRONTEND = "spa" | ||
|
||
LOGIN_URL = "/login/" | ||
LOGOUT_URL = "/logout/" | ||
LOGIN_REDIRECT_URL = "/" | ||
LOGOUT_REDIRECT_URL = "/" | ||
|
||
# PSA for login | ||
|
||
_SOCIAL_AUTH_DATAPORTEN_KEY = get_str_env("ARGUS_DATAPORTEN_KEY") | ||
_SOCIAL_AUTH_DATAPORTEN_SECRET = get_str_env("ARGUS_DATAPORTEN_SECRET") | ||
|
||
SOCIAL_AUTH_DATAPORTEN_EMAIL_KEY = _SOCIAL_AUTH_DATAPORTEN_KEY | ||
SOCIAL_AUTH_DATAPORTEN_EMAIL_SECRET = _SOCIAL_AUTH_DATAPORTEN_SECRET | ||
|
||
SOCIAL_AUTH_DATAPORTEN_FEIDE_KEY = _SOCIAL_AUTH_DATAPORTEN_KEY | ||
SOCIAL_AUTH_DATAPORTEN_FEIDE_SECRET = _SOCIAL_AUTH_DATAPORTEN_SECRET | ||
|
||
AUTHENTICATION_BACKENDS = [ | ||
"argus.spa.dataporten.social.DataportenFeideOAuth2", | ||
"django.contrib.auth.backends.RemoteUserBackend", | ||
"django.contrib.auth.backends.ModelBackend", | ||
] | ||
from .spa_settings import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from argus.site.settings import get_str_env | ||
|
||
|
||
FRONTEND = "spa" | ||
|
||
LOGIN_URL = "/login/" | ||
LOGOUT_URL = "/logout/" | ||
LOGIN_REDIRECT_URL = "/" | ||
LOGOUT_REDIRECT_URL = "/" | ||
|
||
# PSA for login | ||
|
||
_SOCIAL_AUTH_DATAPORTEN_KEY = get_str_env("ARGUS_DATAPORTEN_KEY") | ||
_SOCIAL_AUTH_DATAPORTEN_SECRET = get_str_env("ARGUS_DATAPORTEN_SECRET") | ||
|
||
SOCIAL_AUTH_DATAPORTEN_EMAIL_KEY = _SOCIAL_AUTH_DATAPORTEN_KEY | ||
SOCIAL_AUTH_DATAPORTEN_EMAIL_SECRET = _SOCIAL_AUTH_DATAPORTEN_SECRET | ||
|
||
SOCIAL_AUTH_DATAPORTEN_FEIDE_KEY = _SOCIAL_AUTH_DATAPORTEN_KEY | ||
SOCIAL_AUTH_DATAPORTEN_FEIDE_SECRET = _SOCIAL_AUTH_DATAPORTEN_SECRET | ||
|
||
AUTHENTICATION_BACKENDS = [ | ||
"argus.spa.dataporten.social.DataportenFeideOAuth2", | ||
"django.contrib.auth.backends.RemoteUserBackend", | ||
"django.contrib.auth.backends.ModelBackend", | ||
] | ||
|
||
ROOT_URLCONF = "argus.spa.urls" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from django.urls import include, path, re_path | ||
|
||
from social_django.urls import extra | ||
|
||
from argus.spa.views import AuthMethodListView, login_wrapper | ||
|
||
|
||
spa_urlpatterns = [ | ||
path("login-methods/", AuthMethodListView.as_view(), name="login-methods"), | ||
# Overrides social_django's `complete` view | ||
re_path(rf"^oidc/complete/(?P<backend>[^/]+){extra}$", login_wrapper, name="+++complete"), | ||
path("oidc/", include("social_django.urls", namespace="social")), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,6 @@ | ||
from django.urls import include, path, re_path | ||
|
||
from social_django.urls import extra | ||
|
||
from argus.spa.dataporten.views import login_wrapper | ||
from argus.spa.views import AuthMethodListView | ||
|
||
from argus.site.urls import urlpatterns | ||
|
||
spa_urlpatterns = [ | ||
path("login-methods/", AuthMethodListView.as_view(), name="login-methods"), | ||
# Overrides social_django's `complete` view | ||
re_path(rf"^oidc/complete/(?P<backend>[^/]+){extra}$", login_wrapper, name="+++complete"), | ||
path("oidc/", include("social_django.urls", namespace="social")), | ||
] | ||
from .spa_urls import urlpatterns as spa_urlpatterns | ||
|
||
|
||
urlpatterns += spa_urlpatterns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters