Skip to content

Commit

Permalink
Use the new Authentication methods built into gocbcore.
Browse files Browse the repository at this point in the history
Change-Id: I3ce10d99733d446fd8ac72c243aec994cf6d3a3a
Reviewed-on: http://review.couchbase.org/74942
Reviewed-by: Mark Nunberg <mark.nunberg@couchbase.com>
Tested-by: Brett Lawson <brett19@gmail.com>
  • Loading branch information
brett19 committed Mar 28, 2017
1 parent 4bc2e17 commit e1aa185
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,20 +145,8 @@ func specToHosts(spec connSpec) ([]string, []string, bool) {
}

func (c *Cluster) makeAgentConfig(bucket, password string, mt bool) (*gocbcore.AgentConfig, error) {
authFn := func(srv gocbcore.AuthClient, deadline time.Time) error {
// Build PLAIN auth data
userBuf := []byte(bucket)
passBuf := []byte(password)
authData := make([]byte, 1+len(userBuf)+1+len(passBuf))
authData[0] = 0
copy(authData[1:], userBuf)
authData[1+len(userBuf)] = 0
copy(authData[1+len(userBuf)+1:], passBuf)

// Execute PLAIN authentication
_, err := srv.ExecSaslAuth([]byte("PLAIN"), authData, deadline)

return err
authFn := func(client gocbcore.AuthClient, deadline time.Time) error {
return gocbcore.SaslAuthPlain(bucket, password, client, deadline)
}

memdHosts, httpHosts, isSslHosts := specToHosts(c.spec)
Expand Down

0 comments on commit e1aa185

Please sign in to comment.