Skip to content

Commit 5cdfdac

Browse files
committed
Add bearer auth token for SSO
1 parent c311a2c commit 5cdfdac

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

neo4j/api.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def basic_auth(user, password, realm=None):
108108

109109

110110
def kerberos_auth(base64_encoded_ticket):
111-
""" Generate a kerberos auth token with the base64 encoded ticket
111+
""" Generate a kerberos auth token with the base64 encoded ticket.
112112
113113
This will set the scheme to "kerberos" for the auth token.
114114
@@ -120,6 +120,20 @@ def kerberos_auth(base64_encoded_ticket):
120120
return Auth("kerberos", "", base64_encoded_ticket)
121121

122122

123+
def bearer_auth(base64_encoded_token):
124+
""" Generate an auth token for Single-Sign-On providers.
125+
126+
This will set the scheme to "bearer" for the auth token.
127+
128+
:param base64_encoded_token: a base64 encoded authentication token generated
129+
by a Single-Sign-On provider.
130+
131+
:return: auth token for use with :meth:`GraphDatabase.driver`
132+
:rtype: :class:`neo4j.Auth`
133+
"""
134+
return Auth("bearer", "", base64_encoded_token)
135+
136+
123137
def custom_auth(principal, credentials, realm, scheme, **parameters):
124138
""" Generate a custom auth token.
125139

0 commit comments

Comments
 (0)