auth

package
v1.19.3 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 4 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, hf *frame.HandshakeFrame) (metadata.M, error)

Authenticate finds the authentication strategy in `auths` and then authenticates the Object.

If `auths` is nil or empty, It returns true, means 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 the client's credential
	Authenticate(payload string) (metadata.M, error)
	// 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