Skip to content

Commit 43cb83d

Browse files
author
Zhen
committed
Simplify kerberos auth token creation
1 parent 256d2b6 commit 43cb83d

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

driver/src/main/java/org/neo4j/driver/v1/AuthTokens.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,19 @@ public static AuthToken basic( String username, String password, String realm )
6565
"realm", realm).asMap( Values.ofValue() ) );
6666
}
6767

68+
/**
69+
* The kerberos authentication scheme, using a base64 encoded ticket
70+
* @param base64EncodedTicket a base64 encoded service ticket
71+
* @return an authentication token that can be used to connect to Neo4j
72+
* @see GraphDatabase#driver(String, AuthToken)
73+
* @since 1.3
74+
*/
75+
public static AuthToken kerberos( String base64EncodedTicket )
76+
{
77+
return new InternalAuthToken( parameters(
78+
"scheme", "kerberos",
79+
"credentials", base64EncodedTicket).asMap( Values.ofValue() ) );
80+
}
6881

6982
/**
7083
* A custom authentication token used for doing custom authentication on the server side.
@@ -73,7 +86,7 @@ public static AuthToken basic( String username, String password, String realm )
7386
* @param realm this is the "realm:, specifying the authentication provider.
7487
* @param scheme this it the authentication scheme, specifying what kind of authentication that should be used
7588
* @return an authentication token that can be used to connect to Neo4j
76-
* * @see GraphDatabase#driver(String, AuthToken)
89+
* @see GraphDatabase#driver(String, AuthToken)
7790
*/
7891
public static AuthToken custom( String principal, String credentials, String realm, String scheme)
7992
{
@@ -92,7 +105,7 @@ public static AuthToken custom( String principal, String credentials, String rea
92105
* @param scheme this it the authentication scheme, specifying what kind of authentication that shoud be used
93106
* @param parameters extra parameters to be sent along the authentication provider.
94107
* @return an authentication token that can be used to connect to Neo4j
95-
* * @see GraphDatabase#driver(String, AuthToken)
108+
* @see GraphDatabase#driver(String, AuthToken)
96109
*/
97110
public static AuthToken custom( String principal, String credentials, String realm, String scheme, Map<String, Object> parameters)
98111
{

0 commit comments

Comments
 (0)