コード例 #1
0
ファイル: auth.py プロジェクト: connoryang/dec-eve-serenity
def digest_auth(realm, users, debug = False):
    if check_auth(users, realm=realm):
        if debug:
            cherrypy.log('Auth successful', 'TOOLS.DIGEST_AUTH')
        return
    cherrypy.serving.response.headers['www-authenticate'] = httpauth.digestAuth(realm)
    raise cherrypy.HTTPError(401, 'You are not authorized to access that resource')
コード例 #2
0
def digest_auth(realm, users, debug=False):
    if check_auth(users, realm=realm):
        if debug:
            cherrypy.log('Auth successful', 'TOOLS.DIGEST_AUTH')
        return
    cherrypy.serving.response.headers[
        'www-authenticate'] = httpauth.digestAuth(realm)
    raise cherrypy.HTTPError(401,
                             'You are not authorized to access that resource')
コード例 #3
0
ファイル: auth.py プロジェクト: ddimmich/Cubulus
def digest_auth(realm, users):
    """If auth fails, raise 401 with a digest authentication header.
    
    realm: a string containing the authentication realm.
    users: a dict of the form: {username: password} or a callable returning a dict.
    """
    if check_auth(users):
        return
    
    # inform the user-agent this path is protected
    cherrypy.response.headers['www-authenticate'] = httpauth.digestAuth(realm)
    
    raise cherrypy.HTTPError(401, "You are not authorized to access that resource") 
コード例 #4
0
ファイル: auth.py プロジェクト: TinyHTPC/xbmc-dev-repo
def digest_auth(realm, users):
    """If auth fails, raise 401 with a digest authentication header.

    realm: a string containing the authentication realm.
    users: a dict of the form: {username: password} or a callable returning a dict.
    """
    if check_auth(users, realm=realm):
        return

    # inform the user-agent this path is protected
    cherrypy.response.headers['www-authenticate'] = httpauth.digestAuth(realm)

    raise cherrypy.HTTPError(401, "You are not authorized to access that resource")
コード例 #5
0
ファイル: auth.py プロジェクト: 070499/Sick-Beard
def digest_auth(realm, users, debug=False):
    """If auth fails, raise 401 with a digest authentication header.
    
    realm: a string containing the authentication realm.
    users: a dict of the form: {username: password} or a callable returning a dict.
    """
    if check_auth(users, realm=realm):
        if debug:
            cherrypy.log('Auth successful', 'TOOLS.DIGEST_AUTH')
        return
    
    # inform the user-agent this path is protected
    cherrypy.serving.response.headers['www-authenticate'] = httpauth.digestAuth(realm)
    
    raise cherrypy.HTTPError(401, "You are not authorized to access that resource")
コード例 #6
0
ファイル: auth.py プロジェクト: nanxijw/Clara-Pretty-One-Dick
def digest_auth(realm, users, debug=False):
    """If auth fails, raise 401 with a digest authentication header.
    
    realm
        A string containing the authentication realm.
    users
        A dict of the form: {username: password} or a callable returning a dict.
    """
    if check_auth(users, realm=realm):
        if debug:
            cherrypy.log('Auth successful', 'TOOLS.DIGEST_AUTH')
        return
    cherrypy.serving.response.headers[
        'www-authenticate'] = httpauth.digestAuth(realm)
    raise cherrypy.HTTPError(401,
                             'You are not authorized to access that resource')