This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/api/v2/urls.py

158 lines
7.2 KiB
Python
Raw Normal View History

2019-10-28 13:44:46 +00:00
"""api v2 urls"""
2020-09-11 21:21:11 +00:00
from django.urls import path, re_path
from drf_yasg2 import openapi
from drf_yasg2.views import get_schema_view
from rest_framework import routers
from rest_framework.permissions import AllowAny
2020-10-03 22:28:58 +00:00
from passbook.admin.api.overview import AdministrationOverviewViewSet
2020-10-05 20:09:57 +00:00
from passbook.admin.api.overview_metrics import AdministrationMetricsViewSet
from passbook.admin.api.tasks import TaskViewSet
2020-11-23 10:49:09 +00:00
from passbook.api.v2.config import ConfigsViewSet
2020-09-02 22:04:12 +00:00
from passbook.api.v2.messages import MessagesViewSet
2020-02-28 10:48:55 +00:00
from passbook.audit.api import EventViewSet
from passbook.core.api.applications import ApplicationViewSet
from passbook.core.api.groups import GroupViewSet
2019-10-28 16:55:36 +00:00
from passbook.core.api.propertymappings import PropertyMappingViewSet
from passbook.core.api.providers import ProviderViewSet
from passbook.core.api.sources import SourceViewSet
from passbook.core.api.tokens import TokenViewSet
from passbook.core.api.users import UserViewSet
2020-09-02 22:04:12 +00:00
from passbook.crypto.api import CertificateKeyPairViewSet
2020-05-08 17:46:39 +00:00
from passbook.flows.api import FlowStageBindingViewSet, FlowViewSet, StageViewSet
from passbook.outposts.api import (
DockerServiceConnectionViewSet,
KubernetesServiceConnectionViewSet,
OutpostViewSet,
)
from passbook.policies.api import PolicyBindingViewSet, PolicyViewSet
from passbook.policies.dummy.api import DummyPolicyViewSet
2019-10-28 16:40:57 +00:00
from passbook.policies.expiry.api import PasswordExpiryPolicyViewSet
2020-02-19 08:49:57 +00:00
from passbook.policies.expression.api import ExpressionPolicyViewSet
2020-07-01 19:18:05 +00:00
from passbook.policies.group_membership.api import GroupMembershipPolicyViewSet
2019-10-28 16:40:57 +00:00
from passbook.policies.hibp.api import HaveIBeenPwendPolicyViewSet
from passbook.policies.password.api import PasswordPolicyViewSet
from passbook.policies.reputation.api import ReputationPolicyViewSet
2020-08-19 08:32:44 +00:00
from passbook.providers.oauth2.api import OAuth2ProviderViewSet, ScopeMappingViewSet
2020-11-04 10:04:18 +00:00
from passbook.providers.proxy.api import ProxyOutpostConfigViewSet, ProxyProviderViewSet
from passbook.providers.saml.api import SAMLPropertyMappingViewSet, SAMLProviderViewSet
from passbook.sources.ldap.api import LDAPPropertyMappingViewSet, LDAPSourceViewSet
from passbook.sources.oauth.api import OAuthSourceViewSet
2020-06-24 20:28:40 +00:00
from passbook.sources.saml.api import SAMLSourceViewSet
2020-05-08 17:46:39 +00:00
from passbook.stages.captcha.api import CaptchaStageViewSet
from passbook.stages.consent.api import ConsentStageViewSet
from passbook.stages.dummy.api import DummyStageViewSet
2020-05-08 17:46:39 +00:00
from passbook.stages.email.api import EmailStageViewSet
from passbook.stages.identification.api import IdentificationStageViewSet
from passbook.stages.invitation.api import InvitationStageViewSet, InvitationViewSet
from passbook.stages.otp_static.api import OTPStaticStageViewSet
from passbook.stages.otp_time.api import OTPTimeStageViewSet
from passbook.stages.otp_validate.api import OTPValidateStageViewSet
2020-05-08 17:46:39 +00:00
from passbook.stages.password.api import PasswordStageViewSet
from passbook.stages.prompt.api import PromptStageViewSet, PromptViewSet
from passbook.stages.user_delete.api import UserDeleteStageViewSet
from passbook.stages.user_login.api import UserLoginStageViewSet
2020-05-10 23:12:14 +00:00
from passbook.stages.user_logout.api import UserLogoutStageViewSet
from passbook.stages.user_write.api import UserWriteStageViewSet
router = routers.DefaultRouter()
2019-10-28 16:40:57 +00:00
2020-09-02 22:04:12 +00:00
router.register("root/messages", MessagesViewSet, basename="messages")
2020-11-23 10:49:09 +00:00
router.register("root/config", ConfigsViewSet, basename="configs")
2020-10-03 22:28:58 +00:00
router.register(
"admin/overview", AdministrationOverviewViewSet, basename="admin_overview"
)
2020-10-05 20:09:57 +00:00
router.register("admin/metrics", AdministrationMetricsViewSet, basename="admin_metrics")
router.register("admin/system_tasks", TaskViewSet, basename="admin_system_tasks")
2020-10-03 22:28:58 +00:00
2019-12-31 11:51:16 +00:00
router.register("core/applications", ApplicationViewSet)
router.register("core/groups", GroupViewSet)
router.register("core/users", UserViewSet)
router.register("core/tokens", TokenViewSet)
2020-09-02 22:04:12 +00:00
router.register("outposts/outposts", OutpostViewSet)
2020-11-04 10:04:18 +00:00
router.register("outposts/service_connections/docker", DockerServiceConnectionViewSet)
router.register(
"outposts/service_connections/kubernetes", KubernetesServiceConnectionViewSet
)
2020-11-04 10:04:18 +00:00
router.register("outposts/proxy", ProxyOutpostConfigViewSet)
2020-09-02 22:04:12 +00:00
router.register("flows/instances", FlowViewSet)
router.register("flows/bindings", FlowStageBindingViewSet)
2020-09-02 22:04:12 +00:00
router.register("crypto/certificatekeypairs", CertificateKeyPairViewSet)
2019-12-31 11:51:16 +00:00
router.register("audit/events", EventViewSet)
router.register("sources/all", SourceViewSet)
router.register("sources/ldap", LDAPSourceViewSet)
2020-06-24 20:28:40 +00:00
router.register("sources/saml", SAMLSourceViewSet)
router.register("sources/oauth", OAuthSourceViewSet)
2019-12-31 11:51:16 +00:00
router.register("policies/all", PolicyViewSet)
2020-05-14 11:51:05 +00:00
router.register("policies/bindings", PolicyBindingViewSet)
router.register("policies/expression", ExpressionPolicyViewSet)
2020-07-01 19:18:05 +00:00
router.register("policies/group_membership", GroupMembershipPolicyViewSet)
2019-12-31 11:51:16 +00:00
router.register("policies/haveibeenpwned", HaveIBeenPwendPolicyViewSet)
2020-07-01 19:18:05 +00:00
router.register("policies/password_expiry", PasswordExpiryPolicyViewSet)
2019-12-31 11:51:16 +00:00
router.register("policies/password", PasswordPolicyViewSet)
router.register("policies/reputation", ReputationPolicyViewSet)
router.register("providers/all", ProviderViewSet)
2020-08-19 08:32:44 +00:00
router.register("providers/proxy", ProxyProviderViewSet)
router.register("providers/oauth2", OAuth2ProviderViewSet)
router.register("providers/saml", SAMLProviderViewSet)
2019-12-31 11:51:16 +00:00
router.register("propertymappings/all", PropertyMappingViewSet)
router.register("propertymappings/ldap", LDAPPropertyMappingViewSet)
router.register("propertymappings/saml", SAMLPropertyMappingViewSet)
2020-08-19 08:32:44 +00:00
router.register("propertymappings/scope", ScopeMappingViewSet)
2020-05-08 17:46:39 +00:00
router.register("stages/all", StageViewSet)
router.register("stages/captcha", CaptchaStageViewSet)
router.register("stages/consent", ConsentStageViewSet)
2020-05-08 17:46:39 +00:00
router.register("stages/email", EmailStageViewSet)
router.register("stages/identification", IdentificationStageViewSet)
router.register("stages/invitation", InvitationStageViewSet)
router.register("stages/invitation/invitations", InvitationViewSet)
router.register("stages/otp_static", OTPStaticStageViewSet)
router.register("stages/otp_time", OTPTimeStageViewSet)
router.register("stages/otp_validate", OTPValidateStageViewSet)
2020-05-08 17:46:39 +00:00
router.register("stages/password", PasswordStageViewSet)
router.register("stages/prompt/prompts", PromptViewSet)
router.register("stages/prompt/stages", PromptStageViewSet)
router.register("stages/user_delete", UserDeleteStageViewSet)
router.register("stages/user_login", UserLoginStageViewSet)
2020-05-10 23:12:14 +00:00
router.register("stages/user_logout", UserLogoutStageViewSet)
router.register("stages/user_write", UserWriteStageViewSet)
router.register("stages/dummy", DummyStageViewSet)
router.register("policies/dummy", DummyPolicyViewSet)
2019-10-28 16:40:57 +00:00
info = openapi.Info(
title="passbook API",
2019-12-31 11:51:16 +00:00
default_version="v2",
2019-10-28 16:40:57 +00:00
contact=openapi.Contact(email="hello@beryju.org"),
license=openapi.License(name="MIT License"),
)
SchemaView = get_schema_view(
2020-09-30 17:34:22 +00:00
info,
public=True,
permission_classes=(AllowAny,),
2019-10-28 16:40:57 +00:00
)
urlpatterns = [
2020-09-11 21:21:11 +00:00
re_path(
2019-12-31 11:51:16 +00:00
r"^swagger(?P<format>\.json|\.yaml)$",
SchemaView.without_ui(cache_timeout=0),
name="schema-json",
),
path(
"swagger/",
SchemaView.with_ui("swagger", cache_timeout=0),
name="schema-swagger-ui",
),
path("redoc/", SchemaView.with_ui("redoc", cache_timeout=0), name="schema-redoc"),
2019-10-28 16:40:57 +00:00
] + router.urls