diff --git a/authentik/core/api/applications.py b/authentik/core/api/applications.py index 1c6437d7f..fff437bb5 100644 --- a/authentik/core/api/applications.py +++ b/authentik/core/api/applications.py @@ -124,7 +124,13 @@ class ApplicationViewSet(ModelViewSet): ], responses={200: "Success"}, ) - @action(detail=True, methods=["POST"], parser_classes=(MultiPartParser,)) + @action( + detail=True, + pagination_class=None, + filter_backends=[], + methods=["POST"], + parser_classes=(MultiPartParser,), + ) # pylint: disable=unused-argument def set_icon(self, request: Request, slug: str): """Set application icon""" @@ -140,7 +146,7 @@ class ApplicationViewSet(ModelViewSet): "authentik_core.view_application", ["authentik_events.view_event"] ) @swagger_auto_schema(responses={200: CoordinateSerializer(many=True)}) - @action(detail=True) + @action(detail=True, pagination_class=None, filter_backends=[]) # pylint: disable=unused-argument def metrics(self, request: Request, slug: str): """Metrics for application logins""" diff --git a/authentik/core/api/propertymappings.py b/authentik/core/api/propertymappings.py index 980408a4e..4bb6d4bf1 100644 --- a/authentik/core/api/propertymappings.py +++ b/authentik/core/api/propertymappings.py @@ -82,7 +82,7 @@ class PropertyMappingViewSet( return PropertyMapping.objects.select_subclasses() @swagger_auto_schema(responses={200: TypeCreateSerializer(many=True)}) - @action(detail=False) + @action(detail=False, pagination_class=None, filter_backends=[]) def types(self, request: Request) -> Response: """Get all creatable property-mapping types""" data = [] @@ -101,7 +101,7 @@ class PropertyMappingViewSet( request_body=PolicyTestSerializer(), responses={200: PropertyMappingTestResultSerializer}, ) - @action(detail=True, methods=["POST"]) + @action(detail=True, pagination_class=None, filter_backends=[], methods=["POST"]) # pylint: disable=unused-argument, invalid-name def test(self, request: Request, pk: str) -> Response: """Test Property Mapping""" diff --git a/authentik/core/api/providers.py b/authentik/core/api/providers.py index a9249dd4b..3993b0c6f 100644 --- a/authentik/core/api/providers.py +++ b/authentik/core/api/providers.py @@ -65,7 +65,7 @@ class ProviderViewSet( return Provider.objects.select_subclasses() @swagger_auto_schema(responses={200: TypeCreateSerializer(many=True)}) - @action(detail=False) + @action(detail=False, pagination_class=None, filter_backends=[]) def types(self, request: Request) -> Response: """Get all creatable provider types""" data = [] diff --git a/authentik/core/api/sources.py b/authentik/core/api/sources.py index 858e8b5b3..6290d0e38 100644 --- a/authentik/core/api/sources.py +++ b/authentik/core/api/sources.py @@ -62,7 +62,7 @@ class SourceViewSet( return Source.objects.select_subclasses() @swagger_auto_schema(responses={200: TypeCreateSerializer(many=True)}) - @action(detail=False) + @action(detail=False, pagination_class=None, filter_backends=[]) def types(self, request: Request) -> Response: """Get all creatable source types""" data = [] @@ -77,7 +77,7 @@ class SourceViewSet( return Response(TypeCreateSerializer(data, many=True).data) @swagger_auto_schema(responses={200: UserSettingSerializer(many=True)}) - @action(detail=False) + @action(detail=False, pagination_class=None, filter_backends=[]) def user_settings(self, request: Request) -> Response: """Get all sources the user can configure""" _all_sources: Iterable[Source] = Source.objects.filter( diff --git a/authentik/core/api/tokens.py b/authentik/core/api/tokens.py index 2681a39b6..d8c9c6bdf 100644 --- a/authentik/core/api/tokens.py +++ b/authentik/core/api/tokens.py @@ -68,7 +68,7 @@ class TokenViewSet(ModelViewSet): @permission_required("authentik_core.view_token_key") @swagger_auto_schema(responses={200: TokenViewSerializer(many=False)}) - @action(detail=True) + @action(detail=True, pagination_class=None, filter_backends=[]) # pylint: disable=unused-argument def view_key(self, request: Request, identifier: str) -> Response: """Return token key and log access""" diff --git a/authentik/core/api/users.py b/authentik/core/api/users.py index 17b0c706e..d67e890a4 100644 --- a/authentik/core/api/users.py +++ b/authentik/core/api/users.py @@ -93,7 +93,7 @@ class UserViewSet(ModelViewSet): return User.objects.all().exclude(pk=get_anonymous_user().pk) @swagger_auto_schema(responses={200: SessionUserSerializer(many=False)}) - @action(detail=False) + @action(detail=False, pagination_class=None, filter_backends=[]) # pylint: disable=invalid-name def me(self, request: Request) -> Response: """Get information about current user""" @@ -109,7 +109,7 @@ class UserViewSet(ModelViewSet): @permission_required("authentik_core.view_user", ["authentik_events.view_event"]) @swagger_auto_schema(responses={200: UserMetricsSerializer(many=False)}) - @action(detail=False) + @action(detail=False, pagination_class=None, filter_backends=[]) def metrics(self, request: Request) -> Response: """User metrics per 1h""" serializer = UserMetricsSerializer(True) @@ -120,7 +120,7 @@ class UserViewSet(ModelViewSet): @swagger_auto_schema( responses={"200": LinkSerializer(many=False)}, ) - @action(detail=True) + @action(detail=True, pagination_class=None, filter_backends=[]) # pylint: disable=invalid-name, unused-argument def recovery(self, request: Request, pk: int) -> Response: """Create a temporary link that a user can use to recover their accounts""" diff --git a/authentik/crypto/api.py b/authentik/crypto/api.py index 27b5b5fa9..b47745144 100644 --- a/authentik/crypto/api.py +++ b/authentik/crypto/api.py @@ -144,7 +144,7 @@ class CertificateKeyPairViewSet(ModelViewSet): return Response(serializer.data) @swagger_auto_schema(responses={200: CertificateDataSerializer(many=False)}) - @action(detail=True) + @action(detail=True, pagination_class=None, filter_backends=[]) # pylint: disable=invalid-name, unused-argument def view_certificate(self, request: Request, pk: str) -> Response: """Return certificate-key pairs certificate and log access""" @@ -159,7 +159,7 @@ class CertificateKeyPairViewSet(ModelViewSet): ) @swagger_auto_schema(responses={200: CertificateDataSerializer(many=False)}) - @action(detail=True) + @action(detail=True, pagination_class=None, filter_backends=[]) # pylint: disable=invalid-name, unused-argument def view_private_key(self, request: Request, pk: str) -> Response: """Return certificate-key pairs private key and log access""" diff --git a/authentik/events/api/notification_transport.py b/authentik/events/api/notification_transport.py index 7fdb5d260..7893d705e 100644 --- a/authentik/events/api/notification_transport.py +++ b/authentik/events/api/notification_transport.py @@ -63,7 +63,7 @@ class NotificationTransportViewSet(ModelViewSet): responses={200: NotificationTransportTestSerializer(many=False)}, request_body=no_body, ) - @action(detail=True, methods=["post"]) + @action(detail=True, pagination_class=None, filter_backends=[], methods=["post"]) # pylint: disable=invalid-name, unused-argument def test(self, request: Request, pk=None) -> Response: """Send example notification using selected transport. Requires diff --git a/authentik/flows/api/flows.py b/authentik/flows/api/flows.py index b2b6d84e4..b92273517 100644 --- a/authentik/flows/api/flows.py +++ b/authentik/flows/api/flows.py @@ -98,7 +98,7 @@ class FlowViewSet(ModelViewSet): @permission_required(None, ["authentik_flows.view_flow_cache"]) @swagger_auto_schema(responses={200: CacheSerializer(many=False)}) - @action(detail=False) + @action(detail=False, pagination_class=None, filter_backends=[]) def cache_info(self, request: Request) -> Response: """Info about cached flows""" return Response(data={"count": len(cache.keys("flow_*"))}) @@ -178,7 +178,7 @@ class FlowViewSet(ModelViewSet): ), }, ) - @action(detail=True) + @action(detail=True, pagination_class=None, filter_backends=[]) # pylint: disable=unused-argument def export(self, request: Request, slug: str) -> Response: """Export flow to .akflow file""" @@ -189,7 +189,7 @@ class FlowViewSet(ModelViewSet): return response @swagger_auto_schema(responses={200: FlowDiagramSerializer()}) - @action(detail=True, methods=["get"]) + @action(detail=True, pagination_class=None, filter_backends=[], methods=["get"]) # pylint: disable=unused-argument def diagram(self, request: Request, slug: str) -> Response: """Return diagram for flow with slug `slug`, in the format used by flowchart.js""" @@ -270,7 +270,13 @@ class FlowViewSet(ModelViewSet): ], responses={200: "Success"}, ) - @action(detail=True, methods=["POST"], parser_classes=(MultiPartParser,)) + @action( + detail=True, + pagination_class=None, + filter_backends=[], + methods=["POST"], + parser_classes=(MultiPartParser,), + ) # pylint: disable=unused-argument def set_background(self, request: Request, slug: str): """Set Flow background""" @@ -285,7 +291,7 @@ class FlowViewSet(ModelViewSet): @swagger_auto_schema( responses={200: LinkSerializer(many=False)}, ) - @action(detail=True) + @action(detail=True, pagination_class=None, filter_backends=[]) # pylint: disable=unused-argument def execute(self, request: Request, slug: str): """Execute flow for current user""" diff --git a/authentik/flows/api/stages.py b/authentik/flows/api/stages.py index c80a426b5..2917256e3 100644 --- a/authentik/flows/api/stages.py +++ b/authentik/flows/api/stages.py @@ -61,7 +61,7 @@ class StageViewSet( return Stage.objects.select_subclasses() @swagger_auto_schema(responses={200: TypeCreateSerializer(many=True)}) - @action(detail=False) + @action(detail=False, pagination_class=None, filter_backends=[]) def types(self, request: Request) -> Response: """Get all creatable stage types""" data = [] @@ -78,7 +78,7 @@ class StageViewSet( return Response(TypeCreateSerializer(data, many=True).data) @swagger_auto_schema(responses={200: UserSettingSerializer(many=True)}) - @action(detail=False) + @action(detail=False, pagination_class=None, filter_backends=[]) def user_settings(self, request: Request) -> Response: """Get all stages the user can configure""" _all_stages: Iterable[Stage] = Stage.objects.all().select_subclasses() diff --git a/authentik/outposts/api/outpost_service_connections.py b/authentik/outposts/api/outpost_service_connections.py index e5f042967..1e3453244 100644 --- a/authentik/outposts/api/outpost_service_connections.py +++ b/authentik/outposts/api/outpost_service_connections.py @@ -71,7 +71,7 @@ class ServiceConnectionViewSet( filterset_fields = ["name"] @swagger_auto_schema(responses={200: TypeCreateSerializer(many=True)}) - @action(detail=False) + @action(detail=False, pagination_class=None, filter_backends=[]) def types(self, request: Request) -> Response: """Get all creatable service connection types""" data = [] @@ -86,7 +86,7 @@ class ServiceConnectionViewSet( return Response(TypeCreateSerializer(data, many=True).data) @swagger_auto_schema(responses={200: ServiceConnectionStateSerializer(many=False)}) - @action(detail=True) + @action(detail=True, pagination_class=None, filter_backends=[]) # pylint: disable=unused-argument, invalid-name def state(self, request: Request, pk: str) -> Response: """Get the service connection's state""" diff --git a/authentik/policies/api/policies.py b/authentik/policies/api/policies.py index 012fe262d..058545574 100644 --- a/authentik/policies/api/policies.py +++ b/authentik/policies/api/policies.py @@ -96,7 +96,7 @@ class PolicyViewSet( ) @swagger_auto_schema(responses={200: TypeCreateSerializer(many=True)}) - @action(detail=False) + @action(detail=False, pagination_class=None, filter_backends=[]) def types(self, request: Request) -> Response: """Get all creatable policy types""" data = [] @@ -113,7 +113,7 @@ class PolicyViewSet( @permission_required("authentik_policies.view_policy_cache") @swagger_auto_schema(responses={200: CacheSerializer(many=False)}) - @action(detail=False) + @action(detail=False, pagination_class=None, filter_backends=[]) def cache_info(self, request: Request) -> Response: """Info about cached policies""" return Response(data={"count": len(cache.keys("policy_*"))}) @@ -139,7 +139,7 @@ class PolicyViewSet( request_body=PolicyTestSerializer(), responses={200: PolicyTestResultSerializer()}, ) - @action(detail=True, methods=["POST"]) + @action(detail=True, pagination_class=None, filter_backends=[], methods=["POST"]) # pylint: disable=unused-argument, invalid-name def test(self, request: Request, pk: str) -> Response: """Test policy""" diff --git a/authentik/sources/oauth/api/source.py b/authentik/sources/oauth/api/source.py index 9b47025e7..7fc13db93 100644 --- a/authentik/sources/oauth/api/source.py +++ b/authentik/sources/oauth/api/source.py @@ -46,8 +46,8 @@ class OAuthSourceSerializer(SourceSerializer): class OAuthSourceProviderType(PassiveSerializer): """OAuth Provider""" - name = CharField(read_only=True) - value = CharField(read_only=True) + name = CharField(required=True) + value = CharField(required=True) class OAuthSourceViewSet(ModelViewSet): diff --git a/swagger.yaml b/swagger.yaml index c7c74ffa7..5f298d076 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -2055,42 +2055,7 @@ paths: get: operationId: core_users_me description: Get information about current user - parameters: - - name: username - in: query - description: '' - required: false - type: string - - name: name - in: query - description: '' - required: false - type: string - - name: is_active - in: query - description: '' - required: false - type: string - - name: ordering - in: query - description: Which field to use when ordering the results. - required: false - type: string - - name: search - in: query - description: A search term. - required: false - type: string - - name: page - in: query - description: Page Index - required: false - type: integer - - name: page_size - in: query - description: Page Size - required: false - type: integer + parameters: [] responses: '200': description: '' @@ -2107,42 +2072,7 @@ paths: get: operationId: core_users_metrics description: User metrics per 1h - parameters: - - name: username - in: query - description: '' - required: false - type: string - - name: name - in: query - description: '' - required: false - type: string - - name: is_active - in: query - description: '' - required: false - type: string - - name: ordering - in: query - description: Which field to use when ordering the results. - required: false - type: string - - name: search - in: query - description: A search term. - required: false - type: string - - name: page - in: query - description: Page Index - required: false - type: integer - - name: page_size - in: query - description: Page Size - required: false - type: integer + parameters: [] responses: '200': description: '' @@ -3860,47 +3790,7 @@ paths: get: operationId: flows_instances_cache_info description: Info about cached flows - parameters: - - name: flow_uuid - in: query - description: '' - required: false - type: string - - name: name - in: query - description: '' - required: false - type: string - - name: slug - in: query - description: '' - required: false - type: string - - name: designation - in: query - description: '' - required: false - type: string - - name: ordering - in: query - description: Which field to use when ordering the results. - required: false - type: string - - name: search - in: query - description: A search term. - required: false - type: string - - name: page - in: query - description: Page Index - required: false - type: integer - - name: page_size - in: query - description: Page Size - required: false - type: integer + parameters: [] responses: '200': description: '' @@ -4963,32 +4853,7 @@ paths: get: operationId: outposts_service_connections_all_types description: Get all creatable service connection types - parameters: - - name: name - in: query - description: '' - required: false - type: string - - name: ordering - in: query - description: Which field to use when ordering the results. - required: false - type: string - - name: search - in: query - description: A search term. - required: false - type: string - - name: page - in: query - description: Page Index - required: false - type: integer - - name: page_size - in: query - description: Page Size - required: false - type: integer + parameters: [] responses: '200': description: '' @@ -5574,37 +5439,7 @@ paths: get: operationId: policies_all_cache_info description: Info about cached policies - parameters: - - name: bindings__isnull - in: query - description: '' - required: false - type: string - - name: promptstage__isnull - in: query - description: '' - required: false - type: string - - name: ordering - in: query - description: Which field to use when ordering the results. - required: false - type: string - - name: search - in: query - description: A search term. - required: false - type: string - - name: page - in: query - description: Page Index - required: false - type: integer - - name: page_size - in: query - description: Page Size - required: false - type: integer + parameters: [] responses: '200': description: '' @@ -5621,37 +5456,7 @@ paths: get: operationId: policies_all_types description: Get all creatable policy types - parameters: - - name: bindings__isnull - in: query - description: '' - required: false - type: string - - name: promptstage__isnull - in: query - description: '' - required: false - type: string - - name: ordering - in: query - description: Which field to use when ordering the results. - required: false - type: string - - name: search - in: query - description: A search term. - required: false - type: string - - name: page - in: query - description: Page Index - required: false - type: integer - - name: page_size - in: query - description: Page Size - required: false - type: integer + parameters: [] responses: '200': description: '' @@ -7831,32 +7636,7 @@ paths: get: operationId: propertymappings_all_types description: Get all creatable property-mapping types - parameters: - - name: managed__isnull - in: query - description: '' - required: false - type: string - - name: ordering - in: query - description: Which field to use when ordering the results. - required: false - type: string - - name: search - in: query - description: A search term. - required: false - type: string - - name: page - in: query - description: Page Index - required: false - type: integer - - name: page_size - in: query - description: Page Size - required: false - type: integer + parameters: [] responses: '200': description: '' @@ -8627,32 +8407,7 @@ paths: get: operationId: providers_all_types description: Get all creatable provider types - parameters: - - name: application__isnull - in: query - description: '' - required: false - type: string - - name: ordering - in: query - description: Which field to use when ordering the results. - required: false - type: string - - name: search - in: query - description: A search term. - required: false - type: string - - name: page - in: query - description: Page Index - required: false - type: integer - - name: page_size - in: query - description: Page Size - required: false - type: integer + parameters: [] responses: '200': description: '' @@ -9484,27 +9239,7 @@ paths: get: operationId: sources_all_types description: Get all creatable source types - parameters: - - name: ordering - in: query - description: Which field to use when ordering the results. - required: false - type: string - - name: search - in: query - description: A search term. - required: false - type: string - - name: page - in: query - description: Page Index - required: false - type: integer - - name: page_size - in: query - description: Page Size - required: false - type: integer + parameters: [] responses: '200': description: '' @@ -9523,27 +9258,7 @@ paths: get: operationId: sources_all_user_settings description: Get all sources the user can configure - parameters: - - name: ordering - in: query - description: Which field to use when ordering the results. - required: false - type: string - - name: search - in: query - description: A search term. - required: false - type: string - - name: page - in: query - description: Page Index - required: false - type: integer - - name: page_size - in: query - description: Page Size - required: false - type: integer + parameters: [] responses: '200': description: '' @@ -9927,6 +9642,25 @@ paths: tags: - sources parameters: [] + /sources/oauth/provider_types/: + get: + operationId: sources_oauth_provider_types + description: Get all creatable source types + parameters: [] + responses: + '200': + description: '' + schema: + type: array + items: + $ref: '#/definitions/OAuthSourceProviderType' + '403': + description: Authentication credentials were invalid, absent or insufficient. + schema: + $ref: '#/definitions/GenericError' + tags: + - sources + parameters: [] /sources/oauth/{slug}/: get: operationId: sources_oauth_read @@ -10541,32 +10275,7 @@ paths: get: operationId: stages_all_types description: Get all creatable stage types - parameters: - - name: name - in: query - description: '' - required: false - type: string - - name: ordering - in: query - description: Which field to use when ordering the results. - required: false - type: string - - name: search - in: query - description: A search term. - required: false - type: string - - name: page - in: query - description: Page Index - required: false - type: integer - - name: page_size - in: query - description: Page Size - required: false - type: integer + parameters: [] responses: '200': description: '' @@ -10585,32 +10294,7 @@ paths: get: operationId: stages_all_user_settings description: Get all stages the user can configure - parameters: - - name: name - in: query - description: '' - required: false - type: string - - name: ordering - in: query - description: Which field to use when ordering the results. - required: false - type: string - - name: search - in: query - description: A search term. - required: false - type: string - - name: page - in: query - description: Page Index - required: false - type: integer - - name: page_size - in: query - description: Page Size - required: false - type: integer + parameters: [] responses: '200': description: '' @@ -17327,6 +17011,20 @@ definitions: title: Callback url type: string readOnly: true + OAuthSourceProviderType: + required: + - name + - value + type: object + properties: + name: + title: Name + type: string + minLength: 1 + value: + title: Value + type: string + minLength: 1 UserOAuthSourceConnection: required: - user diff --git a/web/src/api/Users.ts b/web/src/api/Users.ts index f134d8272..64c30b16b 100644 --- a/web/src/api/Users.ts +++ b/web/src/api/Users.ts @@ -4,7 +4,7 @@ import { DEFAULT_CONFIG } from "./Config"; let _globalMePromise: Promise; export function me(): Promise { if (!_globalMePromise) { - _globalMePromise = new CoreApi(DEFAULT_CONFIG).coreUsersMe({}).catch((ex) => { + _globalMePromise = new CoreApi(DEFAULT_CONFIG).coreUsersMe().catch((ex) => { if (ex.status === 401 || ex.status === 403) { window.location.assign("/"); } diff --git a/web/src/elements/charts/UserChart.ts b/web/src/elements/charts/UserChart.ts index 944e0ab1c..877b1da66 100644 --- a/web/src/elements/charts/UserChart.ts +++ b/web/src/elements/charts/UserChart.ts @@ -8,7 +8,7 @@ import { DEFAULT_CONFIG } from "../../api/Config"; export class UserChart extends AKChart { apiRequest(): Promise { - return new CoreApi(DEFAULT_CONFIG).coreUsersMetrics({}); + return new CoreApi(DEFAULT_CONFIG).coreUsersMetrics(); } getDatasets(data: UserMetrics): Chart.ChartDataSets[] { diff --git a/web/src/pages/admin-overview/cards/FlowCacheStatusCard.ts b/web/src/pages/admin-overview/cards/FlowCacheStatusCard.ts index 52a55ecc5..c802e3dda 100644 --- a/web/src/pages/admin-overview/cards/FlowCacheStatusCard.ts +++ b/web/src/pages/admin-overview/cards/FlowCacheStatusCard.ts @@ -9,7 +9,7 @@ import "../../../elements/forms/ConfirmationForm"; export class FlowCacheStatusCard extends AdminStatusCard { getPrimaryValue(): Promise { - return new FlowsApi(DEFAULT_CONFIG).flowsInstancesCacheInfo({}).then((value) => { + return new FlowsApi(DEFAULT_CONFIG).flowsInstancesCacheInfo().then((value) => { return value.count || 0; }); } diff --git a/web/src/pages/admin-overview/cards/PolicyCacheStatusCard.ts b/web/src/pages/admin-overview/cards/PolicyCacheStatusCard.ts index 00df454c2..74e1ac1ce 100644 --- a/web/src/pages/admin-overview/cards/PolicyCacheStatusCard.ts +++ b/web/src/pages/admin-overview/cards/PolicyCacheStatusCard.ts @@ -10,7 +10,7 @@ import "../../../elements/forms/ConfirmationForm"; export class PolicyCacheStatusCard extends AdminStatusCard { getPrimaryValue(): Promise { - return new PoliciesApi(DEFAULT_CONFIG).policiesAllCacheInfo({}).then((value) => { + return new PoliciesApi(DEFAULT_CONFIG).policiesAllCacheInfo().then((value) => { return value.count || 0; }); } diff --git a/web/src/pages/flows/BoundStagesList.ts b/web/src/pages/flows/BoundStagesList.ts index 2f7100a58..f0a8c7cc5 100644 --- a/web/src/pages/flows/BoundStagesList.ts +++ b/web/src/pages/flows/BoundStagesList.ts @@ -130,7 +130,7 @@ export class BoundStagesList extends Table {