2019-10-28 16:40:57 +00:00
|
|
|
"""SAMLProvider API Views"""
|
|
|
|
from rest_framework.serializers import ModelSerializer
|
|
|
|
from rest_framework.viewsets import ModelViewSet
|
|
|
|
|
|
|
|
from passbook.providers.saml.models import SAMLPropertyMapping, SAMLProvider
|
|
|
|
|
|
|
|
|
|
|
|
class SAMLProviderSerializer(ModelSerializer):
|
|
|
|
"""SAMLProvider Serializer"""
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
|
|
|
model = SAMLProvider
|
2019-12-31 11:51:16 +00:00
|
|
|
fields = [
|
|
|
|
"pk",
|
|
|
|
"name",
|
2020-02-17 16:50:11 +00:00
|
|
|
"processor_path",
|
2019-12-31 11:51:16 +00:00
|
|
|
"acs_url",
|
|
|
|
"audience",
|
|
|
|
"issuer",
|
2020-02-17 16:50:11 +00:00
|
|
|
"assertion_valid_not_before",
|
|
|
|
"assertion_valid_not_on_or_after",
|
|
|
|
"session_valid_not_on_or_after",
|
|
|
|
"property_mappings",
|
|
|
|
"digest_algorithm",
|
|
|
|
"signature_algorithm",
|
2019-12-31 11:51:16 +00:00
|
|
|
"signing",
|
|
|
|
"signing_cert",
|
|
|
|
"signing_key",
|
|
|
|
]
|
2019-10-28 16:40:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SAMLProviderViewSet(ModelViewSet):
|
|
|
|
"""SAMLProvider Viewset"""
|
|
|
|
|
|
|
|
queryset = SAMLProvider.objects.all()
|
|
|
|
serializer_class = SAMLProviderSerializer
|
|
|
|
|
|
|
|
|
|
|
|
class SAMLPropertyMappingSerializer(ModelSerializer):
|
|
|
|
"""SAMLPropertyMapping Serializer"""
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
|
|
|
model = SAMLPropertyMapping
|
2020-02-17 16:50:11 +00:00
|
|
|
fields = ["pk", "name", "saml_name", "friendly_name", "template"]
|
2019-10-28 16:40:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SAMLPropertyMappingViewSet(ModelViewSet):
|
|
|
|
"""SAMLPropertyMapping Viewset"""
|
|
|
|
|
|
|
|
queryset = SAMLPropertyMapping.objects.all()
|
|
|
|
serializer_class = SAMLPropertyMappingSerializer
|