Documentation ¶
Index ¶
- func Add(http *stdhttp.HTTP) (err error)
- func CheckToken(tokenRaw, tokenType, secret string) (*auth.Identity, error)
- func ClientHeader(user string, secret string, lifetime time.Duration) (headerString string, err error)
- func CreateToken(username string, secret string, tokenType string, now, exp time.Time) (token string, err error)
- func ExtractToken(tokenRaw, secret string) (tokenType string, status bool, err error)
- func GetToken(cfg *config.Listener, id uint64, path string, w http.ResponseWriter, ...) bool
- func MakeTokens(username string, secret string, lifetimeAccess, lifetimeRefresh time.Duration) (access, refresh string, exp int64, err error)
- func RefreshToken(cfg *config.Listener, id uint64, path string, w http.ResponseWriter, ...) bool
- func VerifyToken(cfg *config.Listener, id uint64, path string, w http.ResponseWriter, ...) bool
- type AuthHandler
- func (ah *AuthHandler) Check(id uint64, prefix string, path string, w http.ResponseWriter, r *http.Request) (identity *auth.Identity, tryNext bool, err error)
- func (ah *AuthHandler) Enabled() bool
- func (ah *AuthHandler) Handler(id uint64, prefix string, path string, w http.ResponseWriter, r *http.Request) (processed bool)
- func (ah *AuthHandler) Init(cfg *config.Listener) (err error)
- func (ah *AuthHandler) Score() int
- func (ah *AuthHandler) WWWAuthHeader() (name string, withRealm bool)
- type JWTTokens
- type JsonError
- type TokenVerify
- type TokenVerifyStatus
- type UserData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckToken ¶ added in v0.1.9
func ClientHeader ¶ added in v0.1.1
func ClientHeader(user string, secret string, lifetime time.Duration) (headerString string, err error)
Создание HTTP заголовка для метода JWT для клиента из имени пользователя и секрета
func CreateToken ¶ added in v0.1.9
func ExtractToken ¶ added in v0.1.9
В теории является дубликатом CheckToken, не не знаю как лучше исправить
func GetToken ¶
func GetToken(cfg *config.Listener, id uint64, path string, w http.ResponseWriter, r *http.Request) bool
GetToken --
func MakeTokens ¶ added in v0.1.9
func RefreshToken ¶ added in v0.1.9
Types ¶
type AuthHandler ¶
type AuthHandler struct {
// contains filtered or unexported fields
}
AuthHandler --
func (*AuthHandler) Check ¶
func (ah *AuthHandler) Check(id uint64, prefix string, path string, w http.ResponseWriter, r *http.Request) (identity *auth.Identity, tryNext bool, err error)
Check --
func (*AuthHandler) Handler ¶
func (ah *AuthHandler) Handler(id uint64, prefix string, path string, w http.ResponseWriter, r *http.Request) (processed bool)
func (*AuthHandler) WWWAuthHeader ¶
func (ah *AuthHandler) WWWAuthHeader() (name string, withRealm bool)
WWWAuthHeader --
type TokenVerify ¶ added in v0.1.9
type TokenVerify struct {
Token string `json:"token"`
}
type TokenVerifyStatus ¶ added in v0.1.9
Click to show internal directories.
Click to hide internal directories.