Esempio n. 1
0
 def test_saml_validation_view(self):
     """
     When called with no parameters, a validation failure should be
     returned.
     """
     request = self.rf.post(reverse('cas_saml_validate'))
     response = SamlValidateView.as_view()(request)
     self.assertContains(response, 'samlp:RequestDenied')
Esempio n. 2
0
 def test_saml_validation_view(self):
     """
     When called with no parameters, a validation failure should be
     returned.
     """
     request = self.rf.post(reverse('cas_saml_validate'))
     response = SamlValidateView.as_view()(request)
     self.assertContains(response, 'samlp:RequestDenied')
Esempio n. 3
0
 def test_saml_validation_view_invalid_service(self):
     """
     When called with an invalid service identifier, a validation
     failure should be returned.
     """
     saml = SamlValidateRequest(context={'ticket': self.st})
     request = self.rf.post(build_url('cas_saml_validate', target=self.url2),
                            saml.render_content(), content_type='text/xml')
     response = SamlValidateView.as_view()(request)
     self.assertContains(response, 'samlp:RequestDenied')
Esempio n. 4
0
 def test_saml_validation_view_http_service(self):
     """
     When called with a non-HTTPS service identifier, a validation
     failure should be returned.
     """
     saml = SamlValidateRequest(context={'ticket': self.st})
     request = self.rf.post(build_url('cas_saml_validate', TARGET='http://www.example.com'),
                            saml.render_content(), content_type='text/xml')
     response = SamlValidateView.as_view()(request)
     self.assertContains(response, 'samlp:RequestDenied')
 def test_saml_validation_view_http_service(self):
     """
     When called with a non-HTTPS service identifier, a validation
     failure should be returned.
     """
     saml = SamlValidateRequest(context={'ticket': self.st})
     request = self.rf.post(build_url('cas_saml_validate', TARGET='http://www.example.com'),
                            saml.render_content(), content_type='text/xml')
     response = SamlValidateView.as_view()(request)
     self.assertContains(response, 'samlp:RequestDenied')
Esempio n. 6
0
 def test_saml_validation_view_invalid_service(self):
     """
     When called with an invalid service identifier, a validation
     failure should be returned.
     """
     saml = SamlValidateRequest(context={'ticket': self.st})
     request = self.rf.post(build_url('cas_saml_validate', target=self.url2),
                            saml.render_content(), content_type='text/xml')
     response = SamlValidateView.as_view()(request)
     self.assertContains(response, 'samlp:RequestDenied')
Esempio n. 7
0
 def test_saml_validation_view_invalid_ticket(self):
     """
     When the provided ticket cannot be found, a validation failure
     should be returned.
     """
     temp_st = ServiceTicketFactory()
     saml = SamlValidateRequest(context={'ticket': temp_st})
     temp_st.delete()
     request = self.rf.post(build_url('cas_saml_validate', target=self.url),
                            saml.render_content(), content_type='text/xml')
     response = SamlValidateView.as_view()(request)
     self.assertContains(response, 'samlp:RequestDenied')
Esempio n. 8
0
 def test_saml_validation_view_invalid_ticket(self):
     """
     When the provided ticket cannot be found, a validation failure
     should be returned.
     """
     temp_st = ServiceTicketFactory()
     saml = SamlValidateRequest(context={'ticket': temp_st})
     temp_st.delete()
     request = self.rf.post(build_url('cas_saml_validate', TARGET=self.st.service),
                            saml.render_content(), content_type='text/xml')
     response = SamlValidateView.as_view()(request)
     self.assertContains(response, 'samlp:RequestDenied')
Esempio n. 9
0
    def test_saml_validation_view_success(self):
        """
        When called with valid parameters, a validation success should
        be returned. The provided ticket should then be consumed.
        """
        saml = SamlValidateRequest(context={'ticket': self.st})
        request = self.rf.post(build_url('cas_saml_validate', target=self.url),
                               saml.render_content(), content_type='text/xml')
        response = SamlValidateView.as_view()(request)
        self.assertContains(response, 'samlp:Success')

        st = ServiceTicket.objects.get(ticket=self.st.ticket)
        self.assertTrue(st.is_consumed())
Esempio n. 10
0
    def test_saml_validation_view_success(self):
        """
        When called with valid parameters, a validation success should
        be returned. The provided ticket should then be consumed.
        """
        saml = SamlValidateRequest(context={'ticket': self.st})
        request = self.rf.post(build_url('cas_saml_validate', TARGET=self.st.service),
                               saml.render_content(), content_type='text/xml')
        response = SamlValidateView.as_view()(request)
        self.assertContains(response, 'samlp:Success')

        st = ServiceTicket.objects.get(ticket=self.st.ticket)
        self.assertTrue(st.is_consumed())
Esempio n. 11
0
from mama_cas.views import LogoutView
from mama_cas.views import ValidateView
from mama_cas.views import ServiceValidateView
from mama_cas.views import ProxyValidateView
from mama_cas.views import ProxyView
from mama_cas.views import WarnView
from mama_cas.views import SamlValidateView

urlpatterns = [
    url(r'^login/?$', LoginView.as_view(), name='cas_login'),
    url(r'^logout/?$', LogoutView.as_view(), name='cas_logout'),
    url(r'^validate/?$', ValidateView.as_view(), name='cas_validate'),
    url(r'^serviceValidate/?$',
        ServiceValidateView.as_view(),
        name='cas_service_validate'),
    url(r'^proxyValidate/?$',
        ProxyValidateView.as_view(),
        name='cas_proxy_validate'),
    url(r'^proxy/?$', ProxyView.as_view(), name='cas_proxy'),
    url(r'^p3/serviceValidate/?$',
        ServiceValidateView.as_view(),
        name='cas_p3_service_validate'),
    url(r'^p3/proxyValidate/?$',
        ProxyValidateView.as_view(),
        name='cas_p3_proxy_validate'),
    url(r'^warn/?$', WarnView.as_view(), name='cas_warn'),
    url(r'^samlValidate/?$',
        SamlValidateView.as_view(),
        name='cas_saml_validate'),
]
Esempio n. 12
0
        LoginView.as_view(),
        name='cas_login'),
    url(r'^logout/?$',
        LogoutView.as_view(),
        name='cas_logout'),
    url(r'^validate/?$',
        ValidateView.as_view(),
        name='cas_validate'),
    url(r'^serviceValidate/?$',
        ServiceValidateView.as_view(),
        name='cas_service_validate'),
    url(r'^proxyValidate/?$',
        ProxyValidateView.as_view(),
        name='cas_proxy_validate'),
    url(r'^proxy/?$',
        ProxyView.as_view(),
        name='cas_proxy'),
    url(r'^p3/serviceValidate/?$',
        ServiceValidateView.as_view(),
        name='cas_p3_service_validate'),
    url(r'^p3/proxyValidate/?$',
        ProxyValidateView.as_view(),
        name='cas_p3_proxy_validate'),
    url(r'^warn/?$',
        WarnView.as_view(),
        name='cas_warn'),
    url(r'^samlValidate/?$',
        SamlValidateView.as_view(),
        name='cas_saml_validate'),
)
Esempio n. 13
0
"""
(2) CAS server URIs as described in the CAS protocol.
"""

from django.conf.urls import url

from mama_cas.views import LoginView
from mama_cas.views import LogoutView
from mama_cas.views import ValidateView
from mama_cas.views import ServiceValidateView
from mama_cas.views import ProxyValidateView
from mama_cas.views import ProxyView
from mama_cas.views import WarnView
from mama_cas.views import SamlValidateView


urlpatterns = [
    url(r'^login/?$', LoginView.as_view(), name='cas_login'),
    url(r'^logout/?$', LogoutView.as_view(), name='cas_logout'),
    url(r'^validate/?$', ValidateView.as_view(), name='cas_validate'),
    url(r'^serviceValidate/?$', ServiceValidateView.as_view(), name='cas_service_validate'),
    url(r'^proxyValidate/?$', ProxyValidateView.as_view(), name='cas_proxy_validate'),
    url(r'^proxy/?$', ProxyView.as_view(), name='cas_proxy'),
    url(r'^p3/serviceValidate/?$', ServiceValidateView.as_view(), name='cas_p3_service_validate'),
    url(r'^p3/proxyValidate/?$', ProxyValidateView.as_view(), name='cas_p3_proxy_validate'),
    url(r'^warn/?$', WarnView.as_view(), name='cas_warn'),
    url(r'^samlValidate/?$', SamlValidateView.as_view(), name='cas_saml_validate'),
]