diff --git a/authentik/providers/proxy/api.py b/authentik/providers/proxy/api.py index 1fc0a56f2..ce0de0add 100644 --- a/authentik/providers/proxy/api.py +++ b/authentik/providers/proxy/api.py @@ -2,7 +2,7 @@ from drf_yasg.utils import swagger_serializer_method from rest_framework.fields import CharField, ListField, SerializerMethodField from rest_framework.serializers import ModelSerializer -from rest_framework.viewsets import ModelViewSet +from rest_framework.viewsets import ModelViewSet, ReadOnlyModelViewSet from authentik.core.api.providers import ProviderSerializer from authentik.core.api.utils import PassiveSerializer @@ -68,16 +68,6 @@ class ProxyOutpostConfigSerializer(ModelSerializer): oidc_configuration = SerializerMethodField() - def create(self, validated_data): - instance: ProxyProvider = super().create(validated_data) - instance.set_oauth_defaults() - instance.save() - return instance - - def update(self, instance: ProxyProvider, validated_data): - instance.set_oauth_defaults() - return super().update(instance, validated_data) - class Meta: model = ProxyProvider @@ -104,9 +94,14 @@ class ProxyOutpostConfigSerializer(ModelSerializer): return ProviderInfoView(request=self.context["request"]._request).get_info(obj) -class ProxyOutpostConfigViewSet(ModelViewSet): +class ProxyOutpostConfigViewSet(ReadOnlyModelViewSet): """ProxyProvider Viewset""" queryset = ProxyProvider.objects.filter(application__isnull=False) serializer_class = ProxyOutpostConfigSerializer ordering = ["name"] + + def get_queryset(self): + qs = super().get_queryset() + print(qs) + return qs diff --git a/swagger.yaml b/swagger.yaml index 842d3fe33..4f332e4e0 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -4730,30 +4730,6 @@ paths: $ref: '#/definitions/GenericError' tags: - outposts - post: - operationId: outposts_proxy_create - description: ProxyProvider Viewset - parameters: - - name: data - in: body - required: true - schema: - $ref: '#/definitions/ProxyOutpostConfig' - responses: - '201': - description: '' - schema: - $ref: '#/definitions/ProxyOutpostConfig' - '400': - description: Invalid input. - schema: - $ref: '#/definitions/ValidationError' - '403': - description: Authentication credentials were invalid, absent or insufficient. - schema: - $ref: '#/definitions/GenericError' - tags: - - outposts parameters: [] /outposts/proxy/{id}/: get: @@ -4776,82 +4752,6 @@ paths: $ref: '#/definitions/APIException' tags: - outposts - put: - operationId: outposts_proxy_update - description: ProxyProvider Viewset - parameters: - - name: data - in: body - required: true - schema: - $ref: '#/definitions/ProxyOutpostConfig' - responses: - '200': - description: '' - schema: - $ref: '#/definitions/ProxyOutpostConfig' - '400': - description: Invalid input. - schema: - $ref: '#/definitions/ValidationError' - '403': - description: Authentication credentials were invalid, absent or insufficient. - schema: - $ref: '#/definitions/GenericError' - '404': - description: Object does not exist or caller has insufficient permissions - to access it. - schema: - $ref: '#/definitions/APIException' - tags: - - outposts - patch: - operationId: outposts_proxy_partial_update - description: ProxyProvider Viewset - parameters: - - name: data - in: body - required: true - schema: - $ref: '#/definitions/ProxyOutpostConfig' - responses: - '200': - description: '' - schema: - $ref: '#/definitions/ProxyOutpostConfig' - '400': - description: Invalid input. - schema: - $ref: '#/definitions/ValidationError' - '403': - description: Authentication credentials were invalid, absent or insufficient. - schema: - $ref: '#/definitions/GenericError' - '404': - description: Object does not exist or caller has insufficient permissions - to access it. - schema: - $ref: '#/definitions/APIException' - tags: - - outposts - delete: - operationId: outposts_proxy_delete - description: ProxyProvider Viewset - parameters: [] - responses: - '204': - description: '' - '403': - description: Authentication credentials were invalid, absent or insufficient. - schema: - $ref: '#/definitions/GenericError' - '404': - description: Object does not exist or caller has insufficient permissions - to access it. - schema: - $ref: '#/definitions/APIException' - tags: - - outposts parameters: - name: id in: path