Esempio n. 1
0
 def get(self, request, *args, **kwargs):
     auth = request.META.get('HTTP_AUTHORIZATION')
     if auth is None:
         return basic_challenge("authenticate to update DNS", 'badauth')
     username, password = basic_authenticate(auth)
     self.hostname = username
     self.secret = password
     return super(JsUpdateView, self).get(request, *args, **kwargs)
Esempio n. 2
0
 def get(self, request, *args, **kwargs):
     auth = request.META.get('HTTP_AUTHORIZATION')
     if auth is None:
         return basic_challenge("authenticate to update DNS", 'badauth')
     username, password = basic_authenticate(auth)
     self.hostname = username
     self.secret = password
     return super(JsUpdateView, self).get(request, *args, **kwargs)
Esempio n. 3
0
def test_basic_auth():
    user_pass = "******", "secret"
    h = make_basic_auth_header(*user_pass)
    assert isinstance(h, str)  # must be str on py2, must be str on py3!
    assert basic_authenticate(h) == user_pass
Esempio n. 4
0
def test_basic_auth():
    user_pass = "******", "secret"
    h = make_basic_auth_header(*user_pass)
    assert isinstance(h, str)  # must be str on py2, must be str on py3!
    assert basic_authenticate(h) == user_pass