-
Notifications
You must be signed in to change notification settings - Fork 31
/
sasl.go
34 lines (29 loc) · 1.06 KB
/
sasl.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package v1alpha1
import corev1 "k8s.io/api/core/v1"
type SASLMechanism string
var (
OAUTHBEARER SASLMechanism = "SASLMechanism"
SCRAMSHA256 SASLMechanism = "SCRAM-SHA-256"
SCRAMSHA512 SASLMechanism = "SCRAM-SHA-512"
GSSAPI SASLMechanism = "GSSAPI"
PLAIN SASLMechanism = "PLAIN"
)
type SASL struct {
// SASLMechanism is the name of the enabled SASL mechanism.
// Possible values: OAUTHBEARER, PLAIN (defaults to PLAIN).
// +optional
Mechanism SASLMechanism `json:"mechanism,omitempty" protobuf:"bytes,1,opt,name=mechanism"`
// User is the authentication identity (authcid) to present for
// SASL/PLAIN or SASL/SCRAM authentication
UserSecret *corev1.SecretKeySelector `json:"userSecret,omitempty" protobuf:"bytes,2,opt,name=user"`
// Password for SASL/PLAIN authentication
PasswordSecret *corev1.SecretKeySelector `json:"passwordSecret,omitempty" protobuf:"bytes,3,opt,name=password"`
}
func (s SASL) GetMechanism() SASLMechanism {
switch s.Mechanism {
case OAUTHBEARER, SCRAMSHA256, SCRAMSHA512, GSSAPI:
return s.Mechanism
default:
return PLAIN
}
}