Changeset View
Changeset View
Standalone View
Standalone View
swh/web/auth/views.py
# Copyright (C) 2020-2022 The Software Heritage developers | # Copyright (C) 2020-2022 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU Affero General Public License version 3, or any later version | # License: GNU Affero General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import json | import json | ||||
from typing import Any, Dict, Union, cast | from typing import Any, Dict, Union, cast | ||||
from cryptography.fernet import InvalidToken | from cryptography.fernet import InvalidToken | ||||
from django.conf.urls import url | |||||
from django.contrib.auth.decorators import login_required | from django.contrib.auth.decorators import login_required | ||||
from django.core.paginator import Paginator | from django.core.paginator import Paginator | ||||
from django.http import HttpRequest | from django.http import HttpRequest | ||||
from django.http.response import ( | from django.http.response import ( | ||||
HttpResponse, | HttpResponse, | ||||
HttpResponseBadRequest, | HttpResponseBadRequest, | ||||
HttpResponseForbidden, | HttpResponseForbidden, | ||||
HttpResponseRedirect, | HttpResponseRedirect, | ||||
JsonResponse, | JsonResponse, | ||||
) | ) | ||||
from django.shortcuts import render | from django.shortcuts import render | ||||
from django.urls import re_path as url | |||||
from django.views.decorators.http import require_http_methods | from django.views.decorators.http import require_http_methods | ||||
from swh.auth.django.models import OIDCUser | from swh.auth.django.models import OIDCUser | ||||
from swh.auth.django.utils import keycloak_oidc_client | from swh.auth.django.utils import keycloak_oidc_client | ||||
from swh.auth.django.views import get_oidc_login_data, oidc_login_view | from swh.auth.django.views import get_oidc_login_data, oidc_login_view | ||||
from swh.auth.django.views import urlpatterns as auth_urlpatterns | from swh.auth.django.views import urlpatterns as auth_urlpatterns | ||||
from swh.auth.keycloak import KeycloakError, keycloak_error_message | from swh.auth.keycloak import KeycloakError, keycloak_error_message | ||||
from swh.web.auth.models import OIDCUserOfflineTokens | from swh.web.auth.models import OIDCUserOfflineTokens | ||||
▲ Show 20 Lines • Show All 167 Lines • Show Last 20 Lines |