auth

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const AuthorizationHeader = "Authorization"
View Source
const BearerPrefix = "Bearer"

Variables

This section is empty.

Functions

This section is empty.

Types

type BearerSecurityScheme

type BearerSecurityScheme struct {
	Type        Type       `json:"type" yaml:"type"`
	Scheme      SchemeName `json:"scheme" yaml:"scheme"`
	In          SchemeIn   `json:"in" yaml:"in"`
	Name        string     `json:"name" yaml:"name"`
	ValidValue  *string    `json:"-" yaml:"-"`
	AttackValue string     `json:"-" yaml:"-"`
}

func NewAuthorizationBearerSecurityScheme

func NewAuthorizationBearerSecurityScheme(name string, value *string) *BearerSecurityScheme

func (*BearerSecurityScheme) GetAttackValue

func (ss *BearerSecurityScheme) GetAttackValue() interface{}

func (*BearerSecurityScheme) GetCookies

func (ss *BearerSecurityScheme) GetCookies() []*http.Cookie

func (*BearerSecurityScheme) GetHeaders

func (ss *BearerSecurityScheme) GetHeaders() http.Header

func (*BearerSecurityScheme) GetValidValue

func (ss *BearerSecurityScheme) GetValidValue() interface{}

func (*BearerSecurityScheme) GetValidValueWriter added in v0.3.1

func (ss *BearerSecurityScheme) GetValidValueWriter() interface{}

func (*BearerSecurityScheme) HasValidValue added in v0.6.0

func (ss *BearerSecurityScheme) HasValidValue() bool

func (*BearerSecurityScheme) SetAttackValue

func (ss *BearerSecurityScheme) SetAttackValue(v interface{})

type JWTBearerSecurityScheme added in v0.5.0

type JWTBearerSecurityScheme struct {
	Type        Type       `json:"type" yaml:"type"`
	Scheme      SchemeName `json:"scheme" yaml:"scheme"`
	In          SchemeIn   `json:"in" yaml:"in"`
	Name        string     `json:"name" yaml:"name"`
	ValidValue  *string    `json:"-" yaml:"-"`
	AttackValue string     `json:"-" yaml:"-"`

	JWTWriter *jwt.JWTWriter `json:"-" yaml:"-"`
}

func NewAuthorizationJWTBearerSecurityScheme added in v0.5.0

func NewAuthorizationJWTBearerSecurityScheme(name string, value *string) (*JWTBearerSecurityScheme, error)

func (*JWTBearerSecurityScheme) GetAttackValue added in v0.5.0

func (ss *JWTBearerSecurityScheme) GetAttackValue() interface{}

func (*JWTBearerSecurityScheme) GetCookies added in v0.5.0

func (ss *JWTBearerSecurityScheme) GetCookies() []*http.Cookie

func (*JWTBearerSecurityScheme) GetHeaders added in v0.5.0

func (ss *JWTBearerSecurityScheme) GetHeaders() http.Header

func (*JWTBearerSecurityScheme) GetValidValue added in v0.5.0

func (ss *JWTBearerSecurityScheme) GetValidValue() interface{}

func (*JWTBearerSecurityScheme) GetValidValueWriter added in v0.5.0

func (ss *JWTBearerSecurityScheme) GetValidValueWriter() interface{}

func (*JWTBearerSecurityScheme) HasValidValue added in v0.6.0

func (ss *JWTBearerSecurityScheme) HasValidValue() bool

func (*JWTBearerSecurityScheme) SetAttackValue added in v0.5.0

func (ss *JWTBearerSecurityScheme) SetAttackValue(v interface{})

type NoAuthSecurityScheme added in v0.3.1

type NoAuthSecurityScheme struct{}

func NewNoAuthSecurityScheme added in v0.3.1

func NewNoAuthSecurityScheme() *NoAuthSecurityScheme

func (*NoAuthSecurityScheme) GetAttackValue added in v0.3.1

func (ss *NoAuthSecurityScheme) GetAttackValue() interface{}

func (*NoAuthSecurityScheme) GetCookies added in v0.3.1

func (ss *NoAuthSecurityScheme) GetCookies() []*http.Cookie

func (*NoAuthSecurityScheme) GetHeaders added in v0.3.1

func (ss *NoAuthSecurityScheme) GetHeaders() http.Header

func (*NoAuthSecurityScheme) GetValidValue added in v0.3.1

func (ss *NoAuthSecurityScheme) GetValidValue() interface{}

func (*NoAuthSecurityScheme) GetValidValueWriter added in v0.3.1

func (ss *NoAuthSecurityScheme) GetValidValueWriter() interface{}

func (*NoAuthSecurityScheme) HasValidValue added in v0.6.0

func (ss *NoAuthSecurityScheme) HasValidValue() bool

func (*NoAuthSecurityScheme) SetAttackValue added in v0.3.1

func (ss *NoAuthSecurityScheme) SetAttackValue(v interface{})

type OAuthConfig added in v0.6.1

type OAuthConfig struct {
	ClientID     string
	ClientSecret string

	TokenURL   string
	RefreshURL string
}

type OAuthFlow added in v0.6.1

type OAuthFlow string
const (
	AuthorizationCodeFlow OAuthFlow = "authorization_code"
	ImplicitFlow          OAuthFlow = "implicit"
	ClientCredentials     OAuthFlow = "client_credentials"
)

type OAuthSecurityScheme added in v0.6.1

type OAuthSecurityScheme struct {
	Type        Type       `json:"type" yaml:"type"`
	Scheme      SchemeName `json:"scheme" yaml:"scheme"`
	In          SchemeIn   `json:"in" yaml:"in"`
	Name        string     `json:"name" yaml:"name"`
	ValidValue  *string    `json:"-" yaml:"-"`
	AttackValue string     `json:"-" yaml:"-"`

	Config    *OAuthConfig   `json:"config" yaml:"config"`
	JWTWriter *jwt.JWTWriter `json:"-" yaml:"-"`
}

func NewOAuthSecurityScheme added in v0.6.1

func NewOAuthSecurityScheme(name string, value *string, cfg *OAuthConfig) *OAuthSecurityScheme

func (*OAuthSecurityScheme) GetAttackValue added in v0.6.1

func (ss *OAuthSecurityScheme) GetAttackValue() interface{}

func (*OAuthSecurityScheme) GetCookies added in v0.6.1

func (ss *OAuthSecurityScheme) GetCookies() []*http.Cookie

func (*OAuthSecurityScheme) GetHeaders added in v0.6.1

func (ss *OAuthSecurityScheme) GetHeaders() http.Header

func (*OAuthSecurityScheme) GetValidValue added in v0.6.1

func (ss *OAuthSecurityScheme) GetValidValue() interface{}

func (*OAuthSecurityScheme) GetValidValueWriter added in v0.6.1

func (ss *OAuthSecurityScheme) GetValidValueWriter() interface{}

func (*OAuthSecurityScheme) HasValidValue added in v0.6.1

func (ss *OAuthSecurityScheme) HasValidValue() bool

func (*OAuthSecurityScheme) SetAttackValue added in v0.6.1

func (ss *OAuthSecurityScheme) SetAttackValue(v interface{})

type SchemeIn

type SchemeIn string
const (
	InHeader SchemeIn = "header"
	InCookie SchemeIn = "cookie"
)

type SchemeName

type SchemeName string
const (
	BasicScheme  SchemeName = "basic"
	BearerScheme SchemeName = "bearer"
	DigestScheme SchemeName = "digest"
	OAuthScheme  SchemeName = "oauth"
	PrivateToken SchemeName = "privateToken"
)

Values are registred in the IANA Authentication Scheme registry https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml

func (*SchemeName) Set

func (s *SchemeName) Set(v string) error

func (*SchemeName) String

func (s *SchemeName) String() string

func (*SchemeName) Type

func (e *SchemeName) Type() string

type SecurityScheme

type SecurityScheme interface {
	GetHeaders() http.Header
	GetCookies() []*http.Cookie
	GetValidValue() interface{}
	HasValidValue() bool
	GetValidValueWriter() interface{}
	SetAttackValue(v interface{})
	GetAttackValue() interface{}
}

type SecuritySchemeValues added in v0.6.1

type SecuritySchemeValues struct {
	Default interface{}
	Values  map[string]interface{}
}

func NewEmptySecuritySchemeValues added in v0.6.1

func NewEmptySecuritySchemeValues() *SecuritySchemeValues

func NewSecuritySchemeValues added in v0.6.1

func NewSecuritySchemeValues(values map[string]interface{}) *SecuritySchemeValues

func (*SecuritySchemeValues) Get added in v0.6.1

func (s *SecuritySchemeValues) Get(key string) interface{}

func (*SecuritySchemeValues) GetDefault added in v0.6.1

func (s *SecuritySchemeValues) GetDefault() interface{}

func (*SecuritySchemeValues) Set added in v0.6.1

func (s *SecuritySchemeValues) Set(key string, value interface{})

func (*SecuritySchemeValues) WithDefault added in v0.6.1

func (s *SecuritySchemeValues) WithDefault(defaultValue interface{}) *SecuritySchemeValues

type SecuritySchemesMap added in v0.6.1

type SecuritySchemesMap map[string]SecurityScheme

type Type

type Type string
const (
	HttpType      Type = "http"
	OAuth2        Type = "oauth2"
	OpenIdConnect Type = "openIdConnect"
	ApiKey        Type = "apiKey"
)

Jump to

Keyboard shortcuts

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