|
1 | 1 | """api v2 urls""" |
| 2 | +from django.conf import settings |
2 | 3 | from django.urls import path, re_path |
3 | 4 | from drf_yasg2 import openapi |
4 | 5 | from drf_yasg2.views import get_schema_view |
|
54 | 55 | from authentik.sources.ldap.api import LDAPPropertyMappingViewSet, LDAPSourceViewSet |
55 | 56 | from authentik.sources.oauth.api import OAuthSourceViewSet |
56 | 57 | from authentik.sources.saml.api import SAMLSourceViewSet |
57 | | -from authentik.stages.authenticator_static.api import AuthenticatorStaticStageViewSet |
58 | | -from authentik.stages.authenticator_totp.api import AuthenticatorTOTPStageViewSet |
| 58 | +from authentik.stages.authenticator_static.api import ( |
| 59 | + AuthenticatorStaticStageViewSet, |
| 60 | + StaticAdminDeviceViewSet, |
| 61 | + StaticDeviceViewSet, |
| 62 | +) |
| 63 | +from authentik.stages.authenticator_totp.api import ( |
| 64 | + AuthenticatorTOTPStageViewSet, |
| 65 | + TOTPAdminDeviceViewSet, |
| 66 | + TOTPDeviceViewSet, |
| 67 | +) |
59 | 68 | from authentik.stages.authenticator_validate.api import ( |
60 | 69 | AuthenticatorValidateStageViewSet, |
61 | 70 | ) |
62 | | -from authentik.stages.authenticator_webauthn.api import AuthenticateWebAuthnStageViewSet |
| 71 | +from authentik.stages.authenticator_webauthn.api import ( |
| 72 | + AuthenticateWebAuthnStageViewSet, |
| 73 | + WebAuthnAdminDeviceViewSet, |
| 74 | + WebAuthnDeviceViewSet, |
| 75 | +) |
63 | 76 | from authentik.stages.captcha.api import CaptchaStageViewSet |
64 | 77 | from authentik.stages.consent.api import ConsentStageViewSet |
65 | 78 | from authentik.stages.deny.api import DenyStageViewSet |
|
133 | 146 | router.register("propertymappings/saml", SAMLPropertyMappingViewSet) |
134 | 147 | router.register("propertymappings/scope", ScopeMappingViewSet) |
135 | 148 |
|
| 149 | +router.register("authenticators/static", StaticDeviceViewSet) |
| 150 | +router.register("authenticators/totp", TOTPDeviceViewSet) |
| 151 | +router.register("authenticators/webauthn", WebAuthnDeviceViewSet) |
| 152 | +router.register("authenticators/admin/static", StaticAdminDeviceViewSet) |
| 153 | +router.register("authenticators/admin/totp", TOTPAdminDeviceViewSet) |
| 154 | +router.register("authenticators/admin/webauthn", WebAuthnAdminDeviceViewSet) |
| 155 | + |
136 | 156 | router.register("stages/all", StageViewSet) |
137 | 157 | router.register("stages/authenticator/static", AuthenticatorStaticStageViewSet) |
138 | 158 | router.register("stages/authenticator/totp", AuthenticatorTOTPStageViewSet) |
|
164 | 184 | name="GNU GPLv3", url="https://github.com/BeryJu/authentik/blob/master/LICENSE" |
165 | 185 | ), |
166 | 186 | ) |
167 | | -SchemaView = get_schema_view( |
168 | | - info, |
169 | | - public=True, |
170 | | - permission_classes=(AllowAny,), |
171 | | -) |
| 187 | +SchemaView = get_schema_view(info, public=True, permission_classes=(AllowAny,)) |
172 | 188 |
|
173 | | -urlpatterns = [ |
174 | | - re_path( |
175 | | - r"^swagger(?P<format>\.json|\.yaml)$", |
176 | | - SchemaView.without_ui(cache_timeout=0), |
177 | | - name="schema-json", |
178 | | - ), |
179 | | - path( |
180 | | - "swagger/", |
181 | | - SchemaView.with_ui("swagger", cache_timeout=0), |
182 | | - name="schema-swagger-ui", |
183 | | - ), |
184 | | - path("redoc/", SchemaView.with_ui("redoc", cache_timeout=0), name="schema-redoc"), |
| 189 | +urlpatterns = router.urls + [ |
185 | 190 | path( |
186 | 191 | "flows/executor/<slug:flow_slug>/", |
187 | 192 | FlowExecutorView.as_view(), |
188 | 193 | name="flow-executor", |
189 | 194 | ), |
190 | | -] + router.urls |
| 195 | + re_path( |
| 196 | + r"^swagger(?P<format>\.json|\.yaml)$", |
| 197 | + SchemaView.without_ui(cache_timeout=0), |
| 198 | + name="schema-json", |
| 199 | + ), |
| 200 | +] |
| 201 | + |
| 202 | +if settings.DEBUG: |
| 203 | + urlpatterns = urlpatterns + [ |
| 204 | + path( |
| 205 | + "swagger/", |
| 206 | + SchemaView.with_ui("swagger", cache_timeout=0), |
| 207 | + name="schema-swagger-ui", |
| 208 | + ), |
| 209 | + ] |
0 commit comments