auth

package
v1.18.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL