auth

package
v0.0.0-...-e779149 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RateLimitExceededError  = fmt.Errorf("auth rate limit exceeded")
	IncorrectPasswordError  = fmt.Errorf("incorrect password")
	AccountIsNotActiveError = fmt.Errorf("account is not active")
)

Functions

func PasswordVerify

func PasswordVerify(encryptedPassword, password string) error

Types

type LoginRecorder

type LoginRecorder interface {
	RecordLogin(username string, loginType iamv1alpha2.LoginType, provider string, sourceIP string, userAgent string, authErr error) error
}

func NewLoginRecorder

func NewLoginRecorder(ksClient kubesphere.Interface, userLister iamv1alpha2listers.UserLister) LoginRecorder

type OAuthAuthenticator

type OAuthAuthenticator interface {
	Authenticate(ctx context.Context, provider string, req *http.Request) (authuser.Info, string, error)
}

OAuthAuthenticator authenticate users by OAuth 2.0 Authorization Framework. Note that implement this interface you should also obey the error specification errors.Error defined at package "k8s.io/apimachinery/pkg/api", and restful.ServerError defined at package "github.com/emicklei/go-restful/v3", or the server cannot handle error correctly.

func NewOAuthAuthenticator

func NewOAuthAuthenticator(ksClient kubesphere.Interface,
	userLister iamv1alpha2listers.UserLister,
	options *authentication.Options) OAuthAuthenticator

type PasswordAuthenticator

type PasswordAuthenticator interface {
	Authenticate(ctx context.Context, provider, username, password string) (authuser.Info, string, error)
}

PasswordAuthenticator is an interface implemented by authenticator which take a username ,password and provider. provider refers to the identity provider`s name, if the provider is empty, authenticate from kubesphere account. Note that implement this interface you should also obey the error specification errors.Error defined at package "k8s.io/apimachinery/pkg/api", and restful.ServerError defined at package "github.com/emicklei/go-restful/v3", or the server cannot handle error correctly.

func NewPasswordAuthenticator

func NewPasswordAuthenticator(ksClient kubesphere.Interface,
	userLister iamv1alpha2listers.UserLister,
	options *authentication.Options) PasswordAuthenticator

type TokenManagementInterface

type TokenManagementInterface interface {
	// Verify the given token and returns token.VerifiedResponse
	Verify(token string) (*token.VerifiedResponse, error)
	// IssueTo issue a token for the specified user
	IssueTo(request *token.IssueRequest) (string, error)
	// Revoke revoke the specified token
	Revoke(token string) error
	// RevokeAllUserTokens revoke all user tokens
	RevokeAllUserTokens(username string) error
	// Keys hold encryption and signing keys.
	Keys() *token.Keys
}

TokenManagementInterface Cache issued token, support revocation of tokens after issuance

func NewTokenOperator

func NewTokenOperator(cache cache.Interface, issuer token.Issuer, options *authentication.Options) TokenManagementInterface

Jump to

Keyboard shortcuts

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