Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
__all__ = ('BBSAuth')
class BBSAuth(mech.Mechanism):
"""The bbsauth mechanism simply submits the optional authorization
id, the authentication id, and token separated by null
bytes."""
NULL = u'\x00'
def __init__(self, auth):
self.auth = auth
def verify(self, *args):
return self.auth.verify_token(*args)
state = mech.AuthState
## Server
def challenge(self):
return self.state(self.verify_challenge, None, '')
def verify_challenge(self, entity, response):
try:
token = response.decode('utf-8')
except ValueError as exc:
return self.state(False, entity, None)
try:
result = self.verify(token)
if result:
entity = entity or self.auth.username()
"""bbsauth -- verifies session token
Copyright (c) 2009, Coptix, Inc. All rights reserved.
See the LICENSE file for license terms and warranty disclaimer.
"""
from __future__ import absolute_import
from sasl import mechanism as mech, auth
__all__ = ('BBSAuth')
class BBSAuth(mech.Mechanism):
"""The bbsauth mechanism simply submits the optional authorization
id, the authentication id, and token separated by null
bytes."""
NULL = u'\x00'
def __init__(self, auth):
self.auth = auth
def verify(self, *args):
return self.auth.verify_token(*args)
state = mech.AuthState
## Server