Documentation ¶
Index ¶
Constants ¶
View Source
const KeyToken = "manager:token:valuefirst"
KeyToken is the key to be used for storing the token.
Variables ¶
View Source
var ( // ErrNilClient is the error for nil client. ErrNilClient = errors.New("nil client") )
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option struct { Storage storage.Hub Client TokenClient Key string }
Option is the option of the manager.
type ResponseEnableToken ¶
type ResponseEnableToken struct {
Response string `json:"Response"`
}
ResponseEnableToken is the response of EnableToken.
type ResponseGenerateToken ¶
type ResponseGenerateToken struct { Token string `json:"token"` // ExpiryDate is the expiry date of the token. // The format is "2022-07-10 22:32:30". // The time format used in this package is storage.TimeFormatExpiredDate. ExpiryDate string `json:"expiryDate"` }
ResponseGenerateToken is the response of GenerateToken.
type TokenClient ¶
type TokenClient interface { // GenerateToken generate a token for the user. GenerateToken(ctx context.Context) (res ResponseGenerateToken, err error) // EnableToken enable the token. EnableToken(ctx context.Context, token string) (res ResponseEnableToken, err error) // DisableToken disables the token. DisableToken(ctx context.Context, token string) (res ResponseEnableToken, err error) // DeleteToken disables the token. DeleteToken(ctx context.Context, token string) (res ResponseEnableToken, err error) }
TokenClient is the contract of the token client to manage token.
Click to show internal directories.
Click to hide internal directories.