Documentation ¶
Index ¶
- func Auth(cfg *conf.Security, validator api.TrustedContextValidator) func(http.Handler) http.Handler
- func GetRememberSession(ctx context.Context, header sessions.Header, rememberStore sessions.Store, ...) (*sessions.Session, error)
- func GetSession(ctx context.Context, header sessions.Header, sessionInfoStore sessions.Store, ...) (*sessions.Session, error)
- func NewClientStateContext(ctx context.Context, state ClientState) context.Context
- func NewClientStateWriterContext(ctx context.Context, sw ClientStateWriter) context.Context
- func NewRememberStore(cfg *conf.Security) sessions.Store
- func NewSessionInfoStore(cfg *conf.Security) sessions.Store
- func Refresh(errEncoder khttp.EncodeErrorFunc, provider RefreshTokenProvider, ...) func(http.Handler) http.Handler
- func RememberMeExpireSecondsOrDefault(seconds int) int
- func SessionExpireSecondsOrDefault(seconds int) int
- type ClientState
- type ClientStateImpl
- type ClientStateWriter
- type ClientStateWriterImpl
- func (c *ClientStateWriterImpl) Clear(ctx context.Context) error
- func (c *ClientStateWriterImpl) Save(ctx context.Context) error
- func (c *ClientStateWriterImpl) SetRememberToken(ctx context.Context, token, uid string) error
- func (c *ClientStateWriterImpl) SetSecurityStamp(ctx context.Context, s string) error
- func (c *ClientStateWriterImpl) SetTFAInfo(ctx context.Context, t TFAInfo) error
- func (c *ClientStateWriterImpl) SetTwoFactorClientRemembered(ctx context.Context) error
- func (c *ClientStateWriterImpl) SetUid(ctx context.Context, uid string) error
- func (c *ClientStateWriterImpl) SignOutRememberToken(ctx context.Context) error
- func (c *ClientStateWriterImpl) SignOutSecurityStamp(ctx context.Context) error
- func (c *ClientStateWriterImpl) SignOutTFAInfo(ctx context.Context) error
- func (c *ClientStateWriterImpl) SignOutTwoFactorClientRemembered(ctx context.Context) error
- func (c *ClientStateWriterImpl) SignOutUid(ctx context.Context) error
- type RefreshNewToken
- type RefreshTokenProvider
- type RefreshTokenProviderFunc
- type RememberTokenInfo
- type TFAInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRememberSession ¶
func GetSession ¶
func NewClientStateContext ¶
func NewClientStateContext(ctx context.Context, state ClientState) context.Context
func NewClientStateWriterContext ¶
func NewClientStateWriterContext(ctx context.Context, sw ClientStateWriter) context.Context
func Refresh ¶
func Refresh(errEncoder khttp.EncodeErrorFunc, provider RefreshTokenProvider, validator api.TrustedContextValidator) func(http.Handler) http.Handler
func RememberMeExpireSecondsOrDefault ¶
RememberMeExpireSecondsOrDefault default 30 days
func SessionExpireSecondsOrDefault ¶
SessionExpireSecondsOrDefault default 1 day
Types ¶
type ClientState ¶
type ClientState interface { //GetUid return user id GetUid() string //GetSecurityStamp return SecurityStamp GetSecurityStamp() string GetTwoFactorClientRemembered() bool GetTFAInfo() *TFAInfo GetRememberToken() *RememberTokenInfo }
func FromClientStateContext ¶
func FromClientStateContext(ctx context.Context) (state ClientState, ok bool)
func NewClientState ¶
func NewClientState(s *sessions.Session, rs *sessions.Session) ClientState
type ClientStateImpl ¶
type ClientStateImpl struct {
// contains filtered or unexported fields
}
func (*ClientStateImpl) GetRememberToken ¶
func (c *ClientStateImpl) GetRememberToken() *RememberTokenInfo
func (*ClientStateImpl) GetSecurityStamp ¶
func (c *ClientStateImpl) GetSecurityStamp() string
func (*ClientStateImpl) GetTFAInfo ¶
func (c *ClientStateImpl) GetTFAInfo() *TFAInfo
func (*ClientStateImpl) GetTwoFactorClientRemembered ¶
func (c *ClientStateImpl) GetTwoFactorClientRemembered() bool
func (*ClientStateImpl) GetUid ¶
func (c *ClientStateImpl) GetUid() string
type ClientStateWriter ¶
type ClientStateWriter interface { SetUid(ctx context.Context, uid string) error //SignOutUid clear uid in client state SignOutUid(ctx context.Context) error SetSecurityStamp(ctx context.Context, s string) error SignOutSecurityStamp(ctx context.Context) error SetTwoFactorClientRemembered(ctx context.Context) error SignOutTwoFactorClientRemembered(ctx context.Context) error SetTFAInfo(ctx context.Context, t TFAInfo) error SignOutTFAInfo(ctx context.Context) error SetRememberToken(ctx context.Context, token, uid string) error SignOutRememberToken(ctx context.Context) error Clear(ctx context.Context) error Save(ctx context.Context) error }
func FromClientStateWriterContext ¶
func FromClientStateWriterContext(ctx context.Context) (sw ClientStateWriter, ok bool)
type ClientStateWriterImpl ¶
type ClientStateWriterImpl struct {
// contains filtered or unexported fields
}
func (*ClientStateWriterImpl) Clear ¶
func (c *ClientStateWriterImpl) Clear(ctx context.Context) error
func (*ClientStateWriterImpl) Save ¶
func (c *ClientStateWriterImpl) Save(ctx context.Context) error
func (*ClientStateWriterImpl) SetRememberToken ¶
func (c *ClientStateWriterImpl) SetRememberToken(ctx context.Context, token, uid string) error
func (*ClientStateWriterImpl) SetSecurityStamp ¶
func (c *ClientStateWriterImpl) SetSecurityStamp(ctx context.Context, s string) error
func (*ClientStateWriterImpl) SetTFAInfo ¶
func (c *ClientStateWriterImpl) SetTFAInfo(ctx context.Context, t TFAInfo) error
func (*ClientStateWriterImpl) SetTwoFactorClientRemembered ¶
func (c *ClientStateWriterImpl) SetTwoFactorClientRemembered(ctx context.Context) error
func (*ClientStateWriterImpl) SetUid ¶
func (c *ClientStateWriterImpl) SetUid(ctx context.Context, uid string) error
func (*ClientStateWriterImpl) SignOutRememberToken ¶
func (c *ClientStateWriterImpl) SignOutRememberToken(ctx context.Context) error
func (*ClientStateWriterImpl) SignOutSecurityStamp ¶
func (c *ClientStateWriterImpl) SignOutSecurityStamp(ctx context.Context) error
func (*ClientStateWriterImpl) SignOutTFAInfo ¶
func (c *ClientStateWriterImpl) SignOutTFAInfo(ctx context.Context) error
func (*ClientStateWriterImpl) SignOutTwoFactorClientRemembered ¶
func (c *ClientStateWriterImpl) SignOutTwoFactorClientRemembered(ctx context.Context) error
func (*ClientStateWriterImpl) SignOutUid ¶
func (c *ClientStateWriterImpl) SignOutUid(ctx context.Context) error
type RefreshNewToken ¶
type RefreshTokenProvider ¶
type RefreshTokenProvider interface {
Refresh(ctx context.Context, token string) (t *RefreshNewToken, err error)
}
type RefreshTokenProviderFunc ¶
type RefreshTokenProviderFunc func(ctx context.Context, token string) (t *RefreshNewToken, err error)
func (RefreshTokenProviderFunc) Refresh ¶
func (r RefreshTokenProviderFunc) Refresh(ctx context.Context, token string) (t *RefreshNewToken, err error)
type RememberTokenInfo ¶
Click to show internal directories.
Click to hide internal directories.