Documentation ¶
Overview ¶
Package auth provides authentication methods.
Index ¶
- Constants
- type Decoder
- type JWT
- func (a *JWT) Cookie() (string, []byte)
- func (a *JWT) FinalRepDecode(d *Decoder) error
- func (a *JWT) InitRepDecode(d *Decoder) error
- func (a *JWT) Order() byte
- func (a *JWT) PrepareFinalReq(prms *Prms) error
- func (a *JWT) PrepareInitReq(prms *Prms)
- func (a *JWT) SetToken(token string)
- func (a *JWT) String() string
- func (a *JWT) Typ() string
- type Method
- type Prms
- type SCRAMPBKDF2SHA256
- func (a *SCRAMPBKDF2SHA256) FinalRepDecode(d *Decoder) error
- func (a *SCRAMPBKDF2SHA256) InitRepDecode(d *Decoder) error
- func (a *SCRAMPBKDF2SHA256) Order() byte
- func (a *SCRAMPBKDF2SHA256) PrepareFinalReq(prms *Prms) error
- func (a *SCRAMPBKDF2SHA256) PrepareInitReq(prms *Prms)
- func (a *SCRAMPBKDF2SHA256) SetPassword(password string)
- func (a *SCRAMPBKDF2SHA256) String() string
- func (a *SCRAMPBKDF2SHA256) Typ() string
- type SCRAMSHA256
- func (a *SCRAMSHA256) FinalRepDecode(d *Decoder) error
- func (a *SCRAMSHA256) InitRepDecode(d *Decoder) error
- func (a *SCRAMSHA256) Order() byte
- func (a *SCRAMSHA256) PrepareFinalReq(prms *Prms) error
- func (a *SCRAMSHA256) PrepareInitReq(prms *Prms)
- func (a *SCRAMSHA256) SetPassword(password string)
- func (a *SCRAMSHA256) String() string
- func (a *SCRAMSHA256) Typ() string
- type SessionCookie
- func (a *SessionCookie) FinalRepDecode(d *Decoder) error
- func (a *SessionCookie) InitRepDecode(d *Decoder) error
- func (a *SessionCookie) Order() byte
- func (a *SessionCookie) PrepareFinalReq(prms *Prms) error
- func (a *SessionCookie) PrepareInitReq(prms *Prms)
- func (a *SessionCookie) String() string
- func (a *SessionCookie) Typ() string
- type X509
- func (a *X509) FinalRepDecode(d *Decoder) error
- func (a *X509) InitRepDecode(d *Decoder) error
- func (a *X509) Order() byte
- func (a *X509) PrepareFinalReq(prms *Prms) error
- func (a *X509) PrepareInitReq(prms *Prms)
- func (a *X509) SetCertKey(cert, key []byte)
- func (a *X509) String() string
- func (a *X509) Typ() string
Constants ¶
const ( MtSCRAMSHA256 = "SCRAMSHA256" // password MtSCRAMPBKDF2SHA256 = "SCRAMPBKDF2SHA256" // password pbkdf2 MtX509 = "X509" // client certificate MtJWT = "JWT" // json web token MtSessionCookie = "SessionCookie" // session cookie )
authentication method types supported by the driver: - basic authentication (username, password based) (whether SCRAMSHA256 or SCRAMPBKDF2SHA256) and - X509 (client certificate) authentication and - JWT (token) authentication
const ( MoSessionCookie byte = iota MoX509 MoJWT MoSCRAMPBKDF2SHA256 MoSCRAMSHA256 )
authentication method orders.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder represents an authentication decoder.
func NewDecoder ¶
NewDecoder returns a new decoder instance.
type JWT ¶
type JWT struct {
// contains filtered or unexported fields
}
JWT implements JWT authentication.
func (*JWT) FinalRepDecode ¶
FinalRepDecode implements the Method interface.
func (*JWT) InitRepDecode ¶
InitRepDecode implements the Method interface.
func (*JWT) PrepareFinalReq ¶
PrepareFinalReq implements the Method interface.
func (*JWT) PrepareInitReq ¶
PrepareInitReq implements the Method interface.
type Method ¶
type Method interface { fmt.Stringer Typ() string Order() byte PrepareInitReq(prms *Prms) InitRepDecode(d *Decoder) error PrepareFinalReq(prms *Prms) error FinalRepDecode(d *Decoder) error }
A Method defines the interface for an authentication method.
type Prms ¶
type Prms struct {
// contains filtered or unexported fields
}
Prms represents authentication parameters.
func (*Prms) AddCESU8String ¶
AddCESU8String adds a CESU8 string parameter.
type SCRAMPBKDF2SHA256 ¶
type SCRAMPBKDF2SHA256 struct {
// contains filtered or unexported fields
}
SCRAMPBKDF2SHA256 implements SCRAMPBKDF2SHA256 authentication.
func NewSCRAMPBKDF2SHA256 ¶
func NewSCRAMPBKDF2SHA256(username, password string) *SCRAMPBKDF2SHA256
NewSCRAMPBKDF2SHA256 creates a new authSCRAMPBKDF2SHA256 instance.
func (*SCRAMPBKDF2SHA256) FinalRepDecode ¶
func (a *SCRAMPBKDF2SHA256) FinalRepDecode(d *Decoder) error
FinalRepDecode implements the Method interface.
func (*SCRAMPBKDF2SHA256) InitRepDecode ¶
func (a *SCRAMPBKDF2SHA256) InitRepDecode(d *Decoder) error
InitRepDecode implements the Method interface.
func (*SCRAMPBKDF2SHA256) Order ¶
func (a *SCRAMPBKDF2SHA256) Order() byte
Order implements the CookieGetter interface.
func (*SCRAMPBKDF2SHA256) PrepareFinalReq ¶
func (a *SCRAMPBKDF2SHA256) PrepareFinalReq(prms *Prms) error
PrepareFinalReq implements the Method interface.
func (*SCRAMPBKDF2SHA256) PrepareInitReq ¶
func (a *SCRAMPBKDF2SHA256) PrepareInitReq(prms *Prms)
PrepareInitReq implements the Method interface.
func (*SCRAMPBKDF2SHA256) SetPassword ¶
func (a *SCRAMPBKDF2SHA256) SetPassword(password string)
SetPassword implenets the AuthPasswordSetter interface.
func (*SCRAMPBKDF2SHA256) String ¶
func (a *SCRAMPBKDF2SHA256) String() string
func (*SCRAMPBKDF2SHA256) Typ ¶
func (a *SCRAMPBKDF2SHA256) Typ() string
Typ implements the CookieGetter interface.
type SCRAMSHA256 ¶
type SCRAMSHA256 struct {
// contains filtered or unexported fields
}
SCRAMSHA256 implements SCRAMSHA256 authentication.
func NewSCRAMSHA256 ¶
func NewSCRAMSHA256(username, password string) *SCRAMSHA256
NewSCRAMSHA256 creates a new authSCRAMSHA256 instance.
func (*SCRAMSHA256) FinalRepDecode ¶
func (a *SCRAMSHA256) FinalRepDecode(d *Decoder) error
FinalRepDecode implements the Method interface.
func (*SCRAMSHA256) InitRepDecode ¶
func (a *SCRAMSHA256) InitRepDecode(d *Decoder) error
InitRepDecode implements the Method interface.
func (*SCRAMSHA256) Order ¶
func (a *SCRAMSHA256) Order() byte
Order implements the CookieGetter interface.
func (*SCRAMSHA256) PrepareFinalReq ¶
func (a *SCRAMSHA256) PrepareFinalReq(prms *Prms) error
PrepareFinalReq implements the Method interface.
func (*SCRAMSHA256) PrepareInitReq ¶
func (a *SCRAMSHA256) PrepareInitReq(prms *Prms)
PrepareInitReq implements the Method interface.
func (*SCRAMSHA256) SetPassword ¶
func (a *SCRAMSHA256) SetPassword(password string)
SetPassword implemets the AuthPasswordSetter interface.
func (*SCRAMSHA256) String ¶
func (a *SCRAMSHA256) String() string
func (*SCRAMSHA256) Typ ¶
func (a *SCRAMSHA256) Typ() string
Typ implements the CookieGetter interface.
type SessionCookie ¶
type SessionCookie struct {
// contains filtered or unexported fields
}
SessionCookie implements session cookie authentication.
func NewSessionCookie ¶
func NewSessionCookie(cookie []byte, logonname, clientID string) *SessionCookie
NewSessionCookie creates a new authSessionCookie instance.
func (*SessionCookie) FinalRepDecode ¶
func (a *SessionCookie) FinalRepDecode(d *Decoder) error
FinalRepDecode implements the Method interface.
func (*SessionCookie) InitRepDecode ¶
func (a *SessionCookie) InitRepDecode(d *Decoder) error
InitRepDecode implements the Method interface.
func (*SessionCookie) Order ¶
func (a *SessionCookie) Order() byte
Order implements the CookieGetter interface.
func (*SessionCookie) PrepareFinalReq ¶
func (a *SessionCookie) PrepareFinalReq(prms *Prms) error
PrepareFinalReq implements the Method interface.
func (*SessionCookie) PrepareInitReq ¶
func (a *SessionCookie) PrepareInitReq(prms *Prms)
PrepareInitReq implements the Method interface.
func (*SessionCookie) String ¶
func (a *SessionCookie) String() string
func (*SessionCookie) Typ ¶
func (a *SessionCookie) Typ() string
Typ implements the CookieGetter interface.
type X509 ¶
type X509 struct {
// contains filtered or unexported fields
}
X509 implements X509 authentication.
func (*X509) FinalRepDecode ¶
FinalRepDecode implements the Method interface.
func (*X509) InitRepDecode ¶
InitRepDecode implements the Method interface.
func (*X509) PrepareFinalReq ¶
PrepareFinalReq implements the Method interface.
func (*X509) PrepareInitReq ¶
PrepareInitReq implements the Method interface.
func (*X509) SetCertKey ¶
SetCertKey implements the AuthCertKeySetter interface.