def authenticate(self, req, resp):
"""
Implements the authentication logic.
:param req: Request instance that will be passed through.
:type req: falcon.Request
:param resp: Response instance that will be passed through.
:type resp: falcon.Response
:raises: falcon.HTTPForbidden
"""
cert = req.env.get(SSL_CLIENT_VERIFY, {})
if cert:
for obj in cert.get('subject', ()):
for key, value in obj:
if key == 'commonName' and \
(not self.cn or value == self.cn):
return
# Forbid by default
raise falcon.HTTPForbidden('Forbidden', 'Forbidden')
httpauthclientcert.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录