예제 #1
0
 def test_challenge(self):
     policy = DigestAuthenticationPolicy("test")
     request = make_request()
     response = policy.challenge_view(request)
     response = get_response(response, request)
     self.failUnless(response.startswith("401 Unauthorized"))
     self.failUnless("WWW-Authenticate: Digest" in response)
 def test_challenge(self):
     policy = DigestAuthenticationPolicy("test")
     request = make_request()
     response = policy.challenge_view(request)
     response = get_response(response, request)
     self.failUnless(response.startswith("401 Unauthorized"))
     self.failUnless("WWW-Authenticate: Digest" in response)
예제 #3
0
 def test_challenge_with_extra_domains(self):
     policy = DigestAuthenticationPolicy("test", domain="http://example.com")
     request = make_request()
     app = policy.challenge_view(request)
     self.assertNotEqual(app, None)
     response = get_response(app, request)
     self.failUnless(response.startswith("401 Unauthorized"))
     self.failUnless("http://example.com" in response)
 def test_challenge_with_extra_domains(self):
     policy = DigestAuthenticationPolicy("test", domain="http://example.com")
     request = make_request()
     app = policy.challenge_view(request)
     self.assertNotEqual(app, None)
     response = get_response(app, request)
     self.failUnless(response.startswith("401 Unauthorized"))
     self.failUnless("http://example.com" in response)
예제 #5
0
 def test_challenge_with_stale_nonce(self):
     policy = DigestAuthenticationPolicy("test")
     request = make_request()
     # Identify with a bad nonce to mark it as stale.
     params = get_challenge(policy, request)
     params["nonce"] += "STALE"
     params = build_response(params, request, "tester", "testing")
     self.assertEquals(policy.unauthenticated_userid(request), None)
     # The challenge should then include stale=TRUE
     app = policy.challenge_view(request)
     self.assertNotEqual(app, None)
     response = get_response(app, request)
     self.failUnless(response.startswith("401 Unauthorized"))
     self.failUnless('stale="TRUE"' in response)
 def test_challenge_with_stale_nonce(self):
     policy = DigestAuthenticationPolicy("test")
     request = make_request()
     # Identify with a bad nonce to mark it as stale.
     params = get_challenge(policy, request)
     params["nonce"] += "STALE"
     params = build_response(params, request, "tester", "testing")
     self.assertEquals(policy.unauthenticated_userid(request), None)
     # The challenge should then include stale=TRUE
     app = policy.challenge_view(request)
     self.assertNotEqual(app, None)
     response = get_response(app, request)
     self.failUnless(response.startswith("401 Unauthorized"))
     self.failUnless('stale="TRUE"' in response)