@@ -57,10 +57,17 @@ class AuthToken(object):
57
57
""" Container for auth information
58
58
"""
59
59
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 ):
61
64
self .scheme = scheme
62
65
self .principal = principal
63
66
self .credentials = credentials
67
+ if realm :
68
+ self .realm = realm
69
+ if parameters :
70
+ self .parameters = parameters
64
71
65
72
66
73
class GraphDatabase (object ):
@@ -665,14 +672,28 @@ def __ne__(self, other):
665
672
return not self .__eq__ (other )
666
673
667
674
668
- def basic_auth (user , password ):
675
+ def basic_auth (user , password , realm = None ):
669
676
""" Generate a basic auth token for a given user and password.
670
677
671
678
:param user: user name
672
679
: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
673
694
:return: auth token for use with :meth:`GraphDatabase.driver`
674
695
"""
675
- return AuthToken ("basic" , user , password )
696
+ return AuthToken (scheme , principal , credentials , realm , ** parameters )
676
697
677
698
678
699
def parse_address (address ):
0 commit comments