Skip to content

Commit

Permalink
Added empty principal to fix backwards compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
eebus committed Apr 21, 2017
1 parent 71acb4b commit 1facc66
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 1facc66

Please sign in to comment.