Skip to content

Commit fa64da6

Browse files
committed
Unexport Credential methods
1 parent dba2caf commit fa64da6

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

server/auth.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func scrambleValidation(cached, nonce, scramble []byte) bool {
6767

6868
func (c *Conn) compareNativePasswordAuthData(clientAuthData []byte, credential Credential) error {
6969
if len(clientAuthData) == 0 {
70-
if credential.HasEmptyPassword() {
70+
if credential.hasEmptyPassword() {
7171
return nil
7272
}
7373
return ErrAccessDeniedNoPassword
@@ -92,7 +92,7 @@ func (c *Conn) compareNativePasswordAuthData(clientAuthData []byte, credential C
9292
func (c *Conn) compareSha256PasswordAuthData(clientAuthData []byte, credential Credential) error {
9393
// Empty passwords are not hashed, but sent as empty string
9494
if len(clientAuthData) == 0 {
95-
if credential.HasEmptyPassword() {
95+
if credential.hasEmptyPassword() {
9696
return nil
9797
}
9898
return ErrAccessDeniedNoPassword
@@ -137,7 +137,7 @@ func (c *Conn) compareSha256PasswordAuthData(clientAuthData []byte, credential C
137137
func (c *Conn) compareCacheSha2PasswordAuthData(clientAuthData []byte) error {
138138
// Empty passwords are not hashed, but sent as empty string
139139
if len(clientAuthData) == 0 {
140-
if c.credential.HasEmptyPassword() {
140+
if c.credential.hasEmptyPassword() {
141141
return nil
142142
}
143143
return ErrAccessDeniedNoPassword

server/auth_switch_response.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func (c *Conn) handleCachingSha2PasswordFullAuth(authData []byte) error {
7272

7373
func (c *Conn) checkSha2CacheCredentials(clientAuthData []byte, credential Credential) error {
7474
if len(clientAuthData) == 0 {
75-
if credential.HasEmptyPassword() {
75+
if credential.hasEmptyPassword() {
7676
return nil
7777
}
7878
return ErrAccessDeniedNoPassword

server/authentication_handler.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ type Credential struct {
4545
AuthPluginName string
4646
}
4747

48-
// HashPassword computes the password hash for a given password using the credential's auth plugin.
49-
func (c Credential) HashPassword(password string) (string, error) {
48+
// hashPassword computes the password hash for a given password using the credential's auth plugin.
49+
func (c Credential) hashPassword(password string) (string, error) {
5050
if password == "" {
5151
return "", nil
5252
}
@@ -69,8 +69,8 @@ func (c Credential) HashPassword(password string) (string, error) {
6969
}
7070
}
7171

72-
// HasEmptyPassword returns true if any password in the credential is empty.
73-
func (c Credential) HasEmptyPassword() bool {
72+
// hasEmptyPassword returns true if any password in the credential is empty.
73+
func (c Credential) hasEmptyPassword() bool {
7474
return slices.Contains(c.Passwords, "")
7575
}
7676

0 commit comments

Comments
 (0)