Documentation ¶
Index ¶
- Constants
- Variables
- func AddManualSession(ctx op_context.Context, cipher auth.AuthParameterEncryption, tenancyID string, ...) (auth_session.Session, string, error)
- func GenManualToken(ctx op_context.Context, cipher auth.AuthParameterEncryption, tenancyID string, ...) (string, error)
- func RefreshRequired(code string) bool
- func ReloginRequired(code string) bool
- type AuthNewTokenHandler
- type AuthTokenHandler
- func (a *AuthTokenHandler) Config() interface{}
- func (a *AuthTokenHandler) ErrorDescriptions() map[string]string
- func (a *AuthTokenHandler) ErrorProtocolCodes() map[string]int
- func (a *AuthTokenHandler) GenAccessToken(ctx auth.AuthContext) (*Token, error)
- func (a *AuthTokenHandler) GenRefreshToken(ctx auth.AuthContext, session auth_session.Session) (*Token, error)
- func (a *AuthTokenHandler) GenToken(ctx auth.AuthContext, paramName string, expirationSeconds int) (*Token, error)
- func (a *AuthTokenHandler) Handle(ctx auth.AuthContext) (bool, error)
- func (a *AuthTokenHandler) Init(cfg config.Config, log logger.Logger, vld validator.Validator, ...) error
- func (a *AuthTokenHandler) SessionExpiration() time.Time
- func (a *AuthTokenHandler) SetAuthManager(manager auth.AuthManager)
- type AuthTokenHandlerConfig
- type Token
- type TokenSchema
Constants ¶
View Source
const AccessTokenName = "access-token"
View Source
const CheckTokenProtocol = "check_token"
View Source
const ErrorCodeInvalidToken = "auth_token_invalid"
View Source
const ErrorCodeRefreshDisabled = "refresh_disabled"
View Source
const ErrorCodeSessionExpired = "session_expired"
View Source
const ErrorCodeTokenExpired = "auth_token_expired"
View Source
const ErrorCodeUnknownUser = "unknown_user"
View Source
const NewTokenProtocol = "new_token"
View Source
const RefreshTokenName = "refresh-token"
View Source
const TokenProtocol = "token"
Variables ¶
View Source
var ErrorDescriptions = map[string]string{ ErrorCodeTokenExpired: "Provided authentication token expired", ErrorCodeInvalidToken: "Invalid authentication token", ErrorCodeSessionExpired: "Session expired", ErrorCodeUnknownUser: "Unknown user", ErrorCodeRefreshDisabled: "Refresh disabled", }
Functions ¶
func AddManualSession ¶
func AddManualSession(ctx op_context.Context, cipher auth.AuthParameterEncryption, tenancyID string, users auth_session.WithUserSessionManager, login string, ttlSeconds int, tokenName ...string) (auth_session.Session, string, error)
func GenManualToken ¶
func RefreshRequired ¶
func ReloginRequired ¶
Types ¶
type AuthNewTokenHandler ¶
type AuthNewTokenHandler struct {
AuthTokenHandler
}
func NewNewToken ¶
func NewNewToken(users auth_session.WithUserSessionManager) *AuthNewTokenHandler
func (*AuthNewTokenHandler) Handle ¶
func (a *AuthNewTokenHandler) Handle(ctx auth.AuthContext) (bool, error)
func (*AuthNewTokenHandler) Process ¶
func (a *AuthNewTokenHandler) Process(ctx auth.AuthContext) (bool, *Token, error)
type AuthTokenHandler ¶
type AuthTokenHandler struct { auth.AuthHandlerBase AuthTokenHandlerConfig // contains filtered or unexported fields }
func New ¶
func New(users auth_session.WithUserSessionManager) *AuthTokenHandler
func (*AuthTokenHandler) Config ¶
func (a *AuthTokenHandler) Config() interface{}
func (*AuthTokenHandler) ErrorDescriptions ¶
func (a *AuthTokenHandler) ErrorDescriptions() map[string]string
func (*AuthTokenHandler) ErrorProtocolCodes ¶
func (a *AuthTokenHandler) ErrorProtocolCodes() map[string]int
func (*AuthTokenHandler) GenAccessToken ¶
func (a *AuthTokenHandler) GenAccessToken(ctx auth.AuthContext) (*Token, error)
func (*AuthTokenHandler) GenRefreshToken ¶
func (a *AuthTokenHandler) GenRefreshToken(ctx auth.AuthContext, session auth_session.Session) (*Token, error)
func (*AuthTokenHandler) GenToken ¶
func (a *AuthTokenHandler) GenToken(ctx auth.AuthContext, paramName string, expirationSeconds int) (*Token, error)
func (*AuthTokenHandler) Handle ¶
func (a *AuthTokenHandler) Handle(ctx auth.AuthContext) (bool, error)
func (*AuthTokenHandler) SessionExpiration ¶
func (a *AuthTokenHandler) SessionExpiration() time.Time
func (*AuthTokenHandler) SetAuthManager ¶
func (a *AuthTokenHandler) SetAuthManager(manager auth.AuthManager)
type AuthTokenHandlerConfig ¶
type AuthTokenHandlerConfig struct { ACCESS_TOKEN_TTL_SECONDS int `default:"900" validate:"gt=0"` REFRESH_TOKEN_TTL_SECONDS int `default:"43200" validate:"gt=0"` ACCESS_TOKEN_GEN_BEFORE_SECONDS int `default:"60" validate:"gt=0"` AUTO_PROLONGATE_ACCESS bool `default:"true"` AUTO_PROLONGATE_REFRESH bool `default:"true"` REFRESH_PATH string `default:"/auth/refresh"` LOGOUT_PATH string `default:"/auth/logout"` ACCESS_TOKEN_NAME string `default:"access-token"` DIRECT_TOKEN_NAME bool DISABLE_REFRESH bool }
type TokenSchema ¶
type TokenSchema struct { auth.AuthSchema Token *AuthTokenHandler }
func NewSchema ¶
func NewSchema(users auth_session.WithUserSessionManager) *TokenSchema
func (*TokenSchema) Handlers ¶
func (t *TokenSchema) Handlers() []auth.AuthHandler
func (*TokenSchema) SetAuthManager ¶
func (t *TokenSchema) SetAuthManager(manager auth.AuthManager)
Click to show internal directories.
Click to hide internal directories.