mirror of
https://github.com/Eugeny/tabby-web.git
synced 2026-08-17 23:06:04 +01:00
auth
This commit is contained in:
@@ -1,17 +1,9 @@
|
||||
"""
|
||||
Django settings for terminus project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 3.2.3.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/3.2/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/3.2/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
from pathlib import Path
|
||||
|
||||
load_dotenv()
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
@@ -25,7 +17,7 @@ SECRET_KEY = 'django-insecure-jw3fshufj(1$iv+&9bie=r%27+^e2sz0!_gq38*5p5!csrm&#s
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
|
||||
# Application definition
|
||||
@@ -135,4 +127,27 @@ CSRF_COOKIE_HTTPONLY = False
|
||||
CSRF_COOKIE_NAME = 'XSRF-TOKEN'
|
||||
CSRF_HEADER_NAME = 'HTTP_X_XSRF_TOKEN'
|
||||
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
'social_core.backends.github.GithubOAuth2',
|
||||
'social_core.backends.gitlab.GitLabOAuth2',
|
||||
'social_core.backends.azuread.AzureADOAuth2',
|
||||
'social_core.backends.microsoft.MicrosoftOAuth2',
|
||||
'social_core.backends.google.GoogleOAuth2',
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
)
|
||||
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
|
||||
APP_DIST_PATH = BASE_DIR / 'app-dist'
|
||||
|
||||
for key in [
|
||||
'SOCIAL_AUTH_GITHUB_KEY',
|
||||
'SOCIAL_AUTH_GITHUB_SECRET',
|
||||
'SOCIAL_AUTH_GITLAB_KEY',
|
||||
'SOCIAL_AUTH_GITLAB_SECRET',
|
||||
'SOCIAL_AUTH_GOOGLE_OAUTH2_KEY',
|
||||
'SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET',
|
||||
'SOCIAL_AUTH_MICROSOFT_GRAPH_KEY',
|
||||
'SOCIAL_AUTH_MICROSOFT_GRAPH_SECRET',
|
||||
]:
|
||||
globals()[key] = os.getenv(key)
|
||||
|
||||
@@ -19,6 +19,6 @@ from .app.urls import urlpatterns
|
||||
|
||||
urlpatterns = [
|
||||
path('', include(urlpatterns)),
|
||||
path('', include('social_django.urls', namespace='social')),
|
||||
path('api/1/auth/social/', include('social_django.urls', namespace='social')),
|
||||
path('admin/', admin.site.urls),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user