feat(base): Enforceable SSO ONLY
this setting removes the login form and forces a redirect to the SSO signin page. !20 #1
This commit is contained in:
@ -35,6 +35,7 @@ SECRET_KEY = 'django-insecure-b*41-$afq0yl)1e#qpz^-nbt-opvjwb#avv++b9rfdxa@b55sk
|
||||
#
|
||||
DEBUG = False # SECURITY WARNING: don't run with debug turned on in production!
|
||||
SSO_ENABLED = False # Enable SSO
|
||||
SSO_LOGIN_ONLY_BACKEND = None # Use specified SSO backend as the ONLY method to login. (builting login form will not be used)
|
||||
|
||||
ALLOWED_HOSTS = [ '*' ]
|
||||
|
||||
@ -258,6 +259,9 @@ if DEBUG:
|
||||
|
||||
if SSO_ENABLED:
|
||||
|
||||
if SSO_LOGIN_ONLY_BACKEND:
|
||||
LOGIN_URL = f'/sso/login/{SSO_LOGIN_ONLY_BACKEND}/'
|
||||
|
||||
AUTHENTICATION_BACKENDS += (
|
||||
*SSO_BACKENDS,
|
||||
)
|
||||
|
@ -1,3 +1,5 @@
|
||||
{% load settings_value %}
|
||||
{% settings_value "SSO_LOGIN_ONLY_BACKEND" as SSO_LOGIN_ONLY_BACKEND %}
|
||||
<html>
|
||||
|
||||
<head>
|
||||
@ -6,14 +8,18 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
{% if SSO_LOGIN_ONLY_BACKEND %}
|
||||
<meta http-equiv="refresh" content="0; url=/{{ settings.LOGIN_URL }}" />
|
||||
{% else %}
|
||||
<link rel="stylesheet" href="{% static 'base.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'content.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'data.css' %}">
|
||||
|
||||
{% endif %}
|
||||
</head>
|
||||
|
||||
<body style="background-color: #393f44">
|
||||
|
||||
|
||||
{% if not SSO_LOGIN_ONLY_BACKEND %}
|
||||
<div style="height: 100%; width: 100%;">
|
||||
|
||||
<div style="display: block; text-align: center; inline-size: auto; margin: auto; background-color: #26292d; margin-top: -185px; height: 370px; margin-left: -272px; width: 544px; position: absolute; top: 50%; left: 50%; padding: 40px">
|
||||
@ -29,8 +35,8 @@
|
||||
{% endfor %}
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</body>
|
||||
|
||||
|
Reference in New Issue
Block a user