@@ -57,10 +57,17 @@ class AuthToken(object):
5757 """ Container for auth information
5858 """
5959
60- def __init__ (self , scheme , principal , credentials ):
60+ #: By default we should not send any realm
61+ realm = None
62+
63+ def __init__ (self , scheme , principal , credentials , realm = None , ** parameters ):
6164 self .scheme = scheme
6265 self .principal = principal
6366 self .credentials = credentials
67+ if realm :
68+ self .realm = realm
69+ if parameters :
70+ self .parameters = parameters
6471
6572
6673class GraphDatabase (object ):
@@ -665,14 +672,28 @@ def __ne__(self, other):
665672 return not self .__eq__ (other )
666673
667674
668- def basic_auth (user , password ):
675+ def basic_auth (user , password , realm = None ):
669676 """ Generate a basic auth token for a given user and password.
670677
671678 :param user: user name
672679 :param password: current password
680+ :param realm: specifies the authentication provider
681+ :return: auth token for use with :meth:`GraphDatabase.driver`
682+ """
683+ return AuthToken ("basic" , user , password , realm )
684+
685+
686+ def custom_auth (principal , credentials , realm , scheme , ** parameters ):
687+ """ Generate a basic auth token for a given user and password.
688+
689+ :param principal: specifies who is being authenticated
690+ :param credentials: authenticates the principal
691+ :param realm: specifies the authentication provider
692+ :param scheme: specifies the type of authentication
693+ :param parameters: parameters passed along to the authenticatin provider
673694 :return: auth token for use with :meth:`GraphDatabase.driver`
674695 """
675- return AuthToken ("basic" , user , password )
696+ return AuthToken (scheme , principal , credentials , realm , ** parameters )
676697
677698
678699def parse_address (address ):
0 commit comments