Skip to content

Commit

Permalink
Finish up PR
Browse files Browse the repository at this point in the history
  • Loading branch information
robsdedude committed Sep 16, 2021
1 parent 6f31cba commit d670b9c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions neo4j/auth_tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ func KerberosAuth(ticket string) AuthToken {
token := AuthToken{
tokens: map[string]interface{}{
keyScheme: schemeKerberos,
// Backwards compatibility: Neo4j servers pre 4.4 require the presence of the principal.
keyPrincipal: "",
keyTicket: ticket,
},
}
Expand Down
12 changes: 9 additions & 3 deletions testkit-backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func (b *backend) handleRequest(req map[string]interface{}) {
authTokenMap := data["authorizationToken"].(map[string]interface{})["data"].(map[string]interface{})
switch authTokenMap["scheme"] {
case "basic":
var realmString = ""
realmString := ""
if realm, ok := authTokenMap["realm"]; ok {
realmString = realm.(string)
}
Expand All @@ -364,8 +364,12 @@ func (b *backend) handleRequest(req map[string]interface{}) {
case "kerberos":
authToken = neo4j.KerberosAuth(authTokenMap["ticket"].(string))
default:
b.writeError(errors.New("Unsupported scheme"))
return
authToken = neo4j.CustomAuth(
authTokenMap["scheme"].(string),
authTokenMap["principal"].(string),
authTokenMap["credentials"].(string),
authTokenMap["realm"].(string),
authTokenMap["parameters"].(map[string]interface{}))
}
// Parse URI (or rather type cast)
uri := data["uri"].(string)
Expand Down Expand Up @@ -570,6 +574,8 @@ func (b *backend) handleRequest(req map[string]interface{}) {
case "GetFeatures":
b.writeResponse("FeatureList", map[string]interface{}{
"features": []string{
"Feature:Auth:Custom",
"Feature:Auth:Kerberos",
"ConfHint:connection.recv_timeout_seconds",
},
})
Expand Down

0 comments on commit d670b9c

Please sign in to comment.