(meta metadata.ConnectionAuthPendingMetadata, publicKey auth2.PublicKey)
| 427 | } |
| 428 | |
| 429 | func (a *authHandler) OnPubKey(meta metadata.ConnectionAuthPendingMetadata, publicKey auth2.PublicKey) ( |
| 430 | bool, |
| 431 | metadata.ConnectionAuthenticatedMetadata, |
| 432 | error, |
| 433 | ) { |
| 434 | user, err := a.userdb.GetUser(meta.Username) |
| 435 | if err != nil { |
| 436 | return false, meta.AuthFailed(), err |
| 437 | } |
| 438 | for _, key := range user.GetAuthorizedKeys() { |
| 439 | if key == publicKey.PublicKey { |
| 440 | return true, meta.Authenticated(meta.Username), nil |
| 441 | } |
| 442 | } |
| 443 | return false, meta.AuthFailed(), fmt.Errorf("authentication failed") |
| 444 | } |
| 445 | |
| 446 | func (a *authHandler) OnAuthorization(meta metadata.ConnectionAuthenticatedMetadata) ( |
| 447 | bool, |
nothing calls this directly
no test coverage detected