mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Goal of this commit is to add some missing features when the Kubernetes API is accessed through a SOCKS5 proxy. That's for example the case when port-forwarding is used (`kubectl port-forward`) or when exec'ing inside a container (`kubectl exec`), with this commit it'll now be possible to use both. Signed-off-by: Romain Aviolat <romain.aviolat@kudelskisecurity.com> Signed-off-by: Romain Jufer <romain.jufer@kudelskisecurity.com>
18 lines
403 B
Go
18 lines
403 B
Go
package socks5
|
|
|
|
// CredentialStore is used to support user/pass authentication
|
|
type CredentialStore interface {
|
|
Valid(user, password string) bool
|
|
}
|
|
|
|
// StaticCredentials enables using a map directly as a credential store
|
|
type StaticCredentials map[string]string
|
|
|
|
func (s StaticCredentials) Valid(user, password string) bool {
|
|
pass, ok := s[user]
|
|
if !ok {
|
|
return false
|
|
}
|
|
return password == pass
|
|
}
|