Skip to content

Commit

Permalink
Merge pull request #358 from eebus/1.3-kerberos-principal
Browse files Browse the repository at this point in the history
Added empty principal to fix kerberos AuthToken
  • Loading branch information
zhenlineo authored Apr 21, 2017
2 parents acf5a07 + 1facc66 commit 3c61c87
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions driver/src/main/java/org/neo4j/driver/v1/AuthTokens.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public static AuthToken kerberos( String base64EncodedTicket )
{
return new InternalAuthToken( parameters(
"scheme", "kerberos",
"principal", "", //This empty string is required for backwards compatibility.
"credentials", base64EncodedTicket).asMap( Values.ofValue() ) );
}

Expand Down
12 changes: 12 additions & 0 deletions driver/src/test/java/org/neo4j/driver/v1/AuthTokensTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,16 @@ public void customAuthParameters()
assertThat( map.get( "realm" ), equalTo( (Value) new StringValue( "baz" ) ) );
assertThat( map.get( "parameters" ), equalTo( (Value) new MapValue( expectedParameters ) ) );
}

@Test
public void basicKerberosAuthWithRealm()
{
InternalAuthToken token = (InternalAuthToken) AuthTokens.kerberos( "base64" );
Map<String,Value> map = token.toMap();

assertThat( map.size(), equalTo( 3 ) );
assertThat( map.get( "scheme" ), equalTo( (Value) new StringValue( "kerberos" ) ) );
assertThat( map.get( "principal" ), equalTo( (Value) new StringValue( "" ) ) );
assertThat( map.get( "credentials" ), equalTo( (Value) new StringValue( "base64" ) ) );
}
}

0 comments on commit 3c61c87

Please sign in to comment.