63
63
class Auth :
64
64
""" Container for auth details.
65
65
66
- :param scheme: specifies the type of authentication, examples: "basic", "kerberos"
66
+ :param scheme: specifies the type of authentication, examples: "basic",
67
+ "kerberos"
67
68
:type scheme: str
68
69
:param principal: specifies who is being authenticated
69
70
:type principal: str or None
70
71
:param credentials: authenticates the principal
71
72
:type credentials: str or None
72
73
:param realm: specifies the authentication provider
73
74
:type realm: str or None
74
- :param parameters: extra key word parameters passed along to the authentication provider
75
+ :param parameters: extra key word parameters passed along to the
76
+ authentication provider
75
77
:type parameters: Dict[str, Any]
76
78
"""
77
79
78
- # TODO in 5.0: change signature to
79
- # def __init__(self, scheme, principal=None, credentials=None,
80
- # ticket=None, realm=None, **parameters):
81
80
def __init__ (self , scheme , principal , credentials , realm = None , ** parameters ):
82
81
self .scheme = scheme
83
82
# Neo4j servers pre 4.4 require the principal field to always be
@@ -86,12 +85,6 @@ def __init__(self, scheme, principal, credentials, realm=None, **parameters):
86
85
self .principal = principal
87
86
if credentials :
88
87
self .credentials = credentials
89
- # TODO in 5.0: add ticket
90
- # :param ticket: alternative to authenticate the principal (depends on
91
- # scheme)
92
- # :type ticket: str or None
93
- # if ticket is not None:
94
- # self.ticket = ticket
95
88
if realm :
96
89
self .realm = realm
97
90
if parameters :
@@ -107,9 +100,12 @@ def basic_auth(user, password, realm=None):
107
100
108
101
This will set the scheme to "basic" for the auth token.
109
102
110
- :param user: user name, this will set the principal
103
+ :param user: user name, this will set the
104
+ :type user: stro
111
105
:param password: current password, this will set the credentials
106
+ :type password: stro
112
107
:param realm: specifies the authentication provider
108
+ :type realm: str or None
113
109
114
110
:return: auth token for use with :meth:`GraphDatabase.driver`
115
111
:rtype: :class:`neo4j.Auth`
@@ -122,15 +118,14 @@ def kerberos_auth(base64_encoded_ticket):
122
118
123
119
This will set the scheme to "kerberos" for the auth token.
124
120
125
- :param base64_encoded_ticket: a base64 encoded service ticket, this will set the credentials
121
+ :param base64_encoded_ticket: a base64 encoded service ticket, this will set
122
+ the credentials
123
+ :type base64_encoded_ticket: str
126
124
127
125
:return: auth token for use with :meth:`GraphDatabase.driver`
128
126
:rtype: :class:`neo4j.Auth`
129
127
"""
130
- token = Auth ("kerberos" , "" , None )
131
- # token field is not supported by any other auth scheme. So we inject it.
132
- token .ticket = base64_encoded_ticket
133
- return token
128
+ return Auth ("kerberos" , "" , base64_encoded_ticket )
134
129
135
130
136
131
def bearer_auth (base64_encoded_token ):
@@ -140,6 +135,7 @@ def bearer_auth(base64_encoded_token):
140
135
141
136
:param base64_encoded_token: a base64 encoded authentication token generated
142
137
by a Single-Sign-On provider.
138
+ :type base64_encoded_token: str
143
139
144
140
:return: auth token for use with :meth:`GraphDatabase.driver`
145
141
:rtype: :class:`neo4j.Auth`
@@ -151,25 +147,22 @@ def custom_auth(principal, credentials, realm, scheme, **parameters):
151
147
""" Generate a custom auth token.
152
148
153
149
:param principal: specifies who is being authenticated
150
+ :type principal: str or None
154
151
:param credentials: authenticates the principal
152
+ :type credentials: str or None
155
153
:param realm: specifies the authentication provider
154
+ :type realm: str or None
156
155
:param scheme: specifies the type of authentication
157
- :param parameters: extra key word parameters passed along to the authentication provider
156
+ :type scheme: str or None
157
+ :param parameters: extra key word parameters passed along to the
158
+ authentication provider
159
+ :type parameters: Dict[str, Any]
158
160
159
161
:return: auth token for use with :meth:`GraphDatabase.driver`
160
162
:rtype: :class:`neo4j.Auth`
161
163
"""
162
164
return Auth (scheme , principal , credentials , realm , ** parameters )
163
165
164
- # TODO in 5.0: alter custom_auth to
165
- # def custom_auth(principal, credentials, ticket, realm, scheme, **parameters):
166
- # """...
167
- # :param ticket: alternative to authenticate the principal (depends on
168
- # scheme)
169
- # ..."""
170
- # return Auth(scheme, principal=principal, credentials=credentials,
171
- # ticket=ticket, realm=realm, **parameter
172
-
173
166
174
167
class Bookmark :
175
168
"""A Bookmark object contains an immutable list of bookmark string values.
0 commit comments