security

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: GPL-3.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultClientValidator

type DefaultClientValidator struct {
	ClientStore store.IClientStore
}

func (*DefaultClientValidator) ExractClientCredentials

func (x *DefaultClientValidator) ExractClientCredentials(ctx *fasthttp.RequestCtx) (r *model.Credential, err, errDesc error)

ExractClientCredentials extract client credential from request

func (*DefaultClientValidator) VerifyCredential

func (x *DefaultClientValidator) VerifyCredential(credential *model.Credential) (model.IClient, error, error)

VerifyCredential verify client id & secret

func (*DefaultClientValidator) VerifyCredentialGrantType

func (x *DefaultClientValidator) VerifyCredentialGrantType(credential *model.Credential, grantType string) (model.IClient, error, error)

VerifyCredentialGrantType verify client id, secret & grant type

func (*DefaultClientValidator) VerifyCredentialGrantTypeScope

func (x *DefaultClientValidator) VerifyCredentialGrantTypeScope(credential *model.Credential, grantType, scopesStr string) (model.IClient, error, error)

VerifyCredentialGrantTypeScope verify client id, secret, grant type & scopes

func (*DefaultClientValidator) VerifyRedirectURI

func (x *DefaultClientValidator) VerifyRedirectURI(clientID, redirectURI string) (model.IClient, error, error)

VerifyRespTypeRedirectURIScope verify client id & redirect uri

func (*DefaultClientValidator) VerifyRespTypeRedirectURIScope

func (x *DefaultClientValidator) VerifyRespTypeRedirectURIScope(clientID, responseType, redirectURI, scopesStr string) (model.IClient, error, error)

VerifyRespTypeRedirectURIScope verify client id & secret, response type, scopes, redirect uri

type DefaultPkceValidator

type DefaultPkceValidator struct{}

func (*DefaultPkceValidator) Verify

func (x *DefaultPkceValidator) Verify(codeVerifier, codeChanllenge, codeChanllengeMethod string) bool

type DefaultResourceOwnerValidator

type DefaultResourceOwnerValidator struct{}

func (*DefaultResourceOwnerValidator) Verify

func (x *DefaultResourceOwnerValidator) Verify(username, password string) (bool, error)

Verify This default validator always return false, please implement your own validator

type IClientValidator

type IClientValidator interface {
	// ExractClientCredentials extract client credential from request
	ExractClientCredentials(ctx *fasthttp.RequestCtx) (*model.Credential, error, error)
	// VerifyCredential verify client id & secret
	VerifyCredential(credential *model.Credential) (model.IClient, error, error)
	// VerifyCredentialGrantType verify client id, secret & grant type
	VerifyCredentialGrantType(credential *model.Credential, grantType string) (model.IClient, error, error)
	// VerifyCredentialGrantTypeScope verify client id, secret, grant type & scopes
	VerifyCredentialGrantTypeScope(credential *model.Credential, grantType, scopesStr string) (model.IClient, error, error)
	// VerifyRespTypeRedirectURIScope verify client, response type, scopes, redirect uri
	VerifyRespTypeRedirectURIScope(clientID, responseType, redirectURI, scopesStr string) (model.IClient, error, error)
	// VerifyRedirectURI verify client id, redirect uri
	VerifyRedirectURI(clientID, logoutRedirectURI string) (model.IClient, error, error)
}

func NewDefaultClientValidator

func NewDefaultClientValidator(clientStore store.IClientStore) IClientValidator

type IPkceValidator

type IPkceValidator interface {
	Verify(codeVerifier, codeChanllenge, codeChanllengeMethod string) bool
}

func NewDefaultPkceValidator

func NewDefaultPkceValidator() IPkceValidator

type IResourceOwnerValidator

type IResourceOwnerValidator interface {
	Verify(username, password string) (bool, error)
}

func NewDefaultResourceOwnerValidator

func NewDefaultResourceOwnerValidator() IResourceOwnerValidator

type ISecretEncryptor

type ISecretEncryptor interface {
	EncryptStringToString(input string) string
	EncryptBytesToBytes(input []byte) []byte
	EncryptBytesToString(input []byte) string

	DecryptStringToString(input string) string
	DecryptBytesToBytes(input []byte) []byte
	DecryptStringToBytes(input string) []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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