Documentation ¶
Overview ¶
Package auth provides authentication.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authenticate ¶ added in v1.10.0
func Authenticate(auths map[string]Authentication, obj *frame.HandshakeFrame) (metadata.M, bool)
Authenticate finds an authentication way in `auths` and authenticates the Object.
If `auths` is nil or empty, It returns true, It think that authentication is not required.
func Register ¶ added in v1.7.3
func Register(authentication Authentication)
Register register authentication
Types ¶
type Authentication ¶
type Authentication interface { // Init authentication initialize arguments Init(args ...string) // Authenticate authentication client's credential Authenticate(payload string) (metadata.M, bool) // Name authentication name Name() string }
Authentication for server
func GetAuth ¶ added in v1.7.3
func GetAuth(name string) (Authentication, bool)
GetAuth get authentication by name
type Credential ¶
type Credential struct {
// contains filtered or unexported fields
}
Credential client credential
func NewCredential ¶ added in v1.7.3
func NewCredential(payload string) *Credential
NewCredential create client credential
func (*Credential) Name ¶ added in v1.7.3
func (c *Credential) Name() string
Name client credential name
func (*Credential) Payload ¶
func (c *Credential) Payload() string
Payload client credential payload
Click to show internal directories.
Click to hide internal directories.