本文整理汇总了Python中python_digest.build_digest_challenge函数的典型用法代码示例。如果您正苦于以下问题:Python build_digest_challenge函数的具体用法?Python build_digest_challenge怎么用?Python build_digest_challenge使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_digest_challenge函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _unauthorized
def _unauthorized(self):
response = HttpUnauthorized()
new_uuid = uuid.uuid4()
opaque = hmac.new(str(new_uuid), digestmod=sha1).hexdigest()
response["WWW-Authenticate"] = python_digest.build_digest_challenge(
time.time(), getattr(settings, "SECRET_KEY", ""), self.realm, opaque, False
)
return response
开发者ID:eykd,项目名称:django-tastypie,代码行数:8,代码来源:authentication.py
示例2: build_challenge_response
def build_challenge_response(self, stale=False):
response = HttpResponse('Authorization Required',
content_type='text/plain', status=401)
opaque = ''.join([random.choice('0123456789ABCDEF') for x in range(32)])
response["WWW-Authenticate"] = python_digest.build_digest_challenge(
time.time(), self.secret_key, self.realm, opaque, stale)
return response
开发者ID:matthieuchoplin,项目名称:django-digest,代码行数:8,代码来源:__init__.py
示例3: _unauthorized
def _unauthorized(self):
response = HttpUnauthorized()
new_uuid = uuid.uuid4()
opaque = hmac.new(str(new_uuid).encode("utf-8"), digestmod=sha1).hexdigest()
response["WWW-Authenticate"] = python_digest.build_digest_challenge(
timestamp=time.time(), secret=settings.SECRET_KEY, realm=self.realm, opaque=opaque, stale=False
)
return response
开发者ID:mattbriancon,项目名称:django-tastypie,代码行数:8,代码来源:authentication.py
示例4: _digest_unauthenticated
def _digest_unauthenticated(request):
response = HttpResponse('', status=401)
u = uuid.uuid4()
o = hmac.new(str(u).encode('utf-8'), digestmod=sha1).hexdigest()
s = python_digest.build_digest_challenge(
timestamp=time.time(),
secret=getattr(settings, 'SECRET_KEY', ''),
realm='DEV',
opaque=o,
stale=False
)
response['WWW-Authenticate'] = s
return response
开发者ID:XemaCobra,项目名称:Cycles,代码行数:14,代码来源:views.py
示例5: build_challenge_response
def build_challenge_response(self, stale=False):
"""
If not auth show digest authentification form
"""
opaque = ''.join([random.choice('0123456789ABCDEF')
for x in range(32)]) # IGNORE:W0612 @UnusedVariable
response = Response()
response.status = 401
response.headerlist.append(('WWW-Authenticate',
python_digest.build_digest_challenge(
time.time(),
self.secret_key,
self.realm, opaque, stale)))
return response
开发者ID:SandStormHoldings,项目名称:NoodlesFramework,代码行数:14,代码来源:__init__.py
示例6: __setAuthenticate
def __setAuthenticate(self, stale=False):
random.seed()
opaque = str(random.getrandbits(128))
www_authenticate_header = python_digest.build_digest_challenge(
time.time(),
self.__cfg.get('nonce_secret'),
Config().get('realm'),
opaque,
stale
)
#grab nonce and calculate reqId
m = re.search('nonce="([a-z-A-Z0-9.:]+)"', www_authenticate_header)
sessId = hashlib.sha1(m.group(1).encode('utf-8')).hexdigest()
self.__storeSession(sessId, opaque, 0)
self.__resp.headers['WWW-Authenticate'] = www_authenticate_header
开发者ID:Education-Numerique,项目名称:api,代码行数:19,代码来源:auth.py
示例7: _unauthorized
def _unauthorized(self):
response = HttpUnauthorized()
new_uuid = uuid.uuid4()
opaque = hmac.new(str(new_uuid), digestmod=sha1).hexdigest()
response['WWW-Authenticate'] = python_digest.build_digest_challenge(time.time(), self.secret_key, self.realm, opaque, False)
return response
开发者ID:garbados,项目名称:piecrust,代码行数:6,代码来源:authentication.py
注:本文中的python_digest.build_digest_challenge函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论