MCPcopy
hub / github.com/ContainerSSH/ContainerSSH / OnPubKey

Method OnPubKey

e2e_framework_test.go:429–444  ·  view source on GitHub ↗
(meta metadata.ConnectionAuthPendingMetadata, publicKey auth2.PublicKey)

Source from the content-addressed store, hash-verified

427}
428
429func (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
446func (a *authHandler) OnAuthorization(meta metadata.ConnectionAuthenticatedMetadata) (
447 bool,

Callers

nothing calls this directly

Calls 5

AuthFailedMethod · 0.80
AuthenticatedMethod · 0.80
GetUserMethod · 0.65
GetAuthorizedKeysMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected