60
60
# TODO: This class is not tested
61
61
class Auth :
62
62
""" Container for auth details.
63
+
64
+ :param scheme: specifies the type of authentication, examples: "basic", "kerberos"
65
+ :type scheme: str
66
+ :param principal: specifies who is being authenticated
67
+ :type principal: str
68
+ :param credentials: authenticates the principal
69
+ :type credentials: str
70
+ :param realm: specifies the authentication provider
71
+ :type realm: str
72
+ :param parameters: extra key word parameters passed along to the authentication provider
73
+ :type parameters: str
63
74
"""
64
75
65
76
#: By default we should not send any realm
@@ -82,32 +93,42 @@ def __init__(self, scheme, principal, credentials, realm=None, **parameters):
82
93
def basic_auth (user , password , realm = None ):
83
94
""" Generate a basic auth token for a given user and password.
84
95
85
- :param user: user name
86
- :param password: current password
96
+ This will set the scheme to "basic" for the auth token.
97
+
98
+ :param user: user name, this will set the principal
99
+ :param password: current password, this will set the credentials
87
100
:param realm: specifies the authentication provider
101
+
88
102
:return: auth token for use with :meth:`GraphDatabase.driver`
103
+ :rtype: :class:`neo4j.Auth`
89
104
"""
90
105
return Auth ("basic" , user , password , realm )
91
106
92
107
93
108
def kerberos_auth (base64_encoded_ticket ):
94
109
""" Generate a kerberos auth token with the base64 encoded ticket
95
110
96
- :param base64_encoded_ticket: a base64 encoded service ticket
97
- :return: an authentication token that can be used to connect to Neo4j
111
+ This will set the scheme to "kerberos" for the auth token.
112
+
113
+ :param base64_encoded_ticket: a base64 encoded service ticket, this will set the credentials
114
+
115
+ :return: auth token for use with :meth:`GraphDatabase.driver`
116
+ :rtype: :class:`neo4j.Auth`
98
117
"""
99
118
return Auth ("kerberos" , "" , base64_encoded_ticket )
100
119
101
120
102
121
def custom_auth (principal , credentials , realm , scheme , ** parameters ):
103
- """ Generate a basic auth token for a given user and password .
122
+ """ Generate a custom auth token.
104
123
105
124
:param principal: specifies who is being authenticated
106
125
:param credentials: authenticates the principal
107
126
:param realm: specifies the authentication provider
108
127
:param scheme: specifies the type of authentication
109
- :param parameters: parameters passed along to the authentication provider
128
+ :param parameters: extra key word parameters passed along to the authentication provider
129
+
110
130
:return: auth token for use with :meth:`GraphDatabase.driver`
131
+ :rtype: :class:`neo4j.Auth`
111
132
"""
112
133
return Auth (scheme , principal , credentials , realm , ** parameters )
113
134
0 commit comments