Documentation
¶
Index ¶
- type ClientSecret
- type ErrorCodeResponse
- type OAuthClient
- func (this *OAuthClient) CheckToken(token string) (*ParamsTokenInfo, fault.TypedError)
- func (this *OAuthClient) CreateHMToken(rlog logrus.FieldLogger, oauthParams OAuthParams) (token *OAuthToken, err fault.TypedError)
- func (this *OAuthClient) CreateMToken(rlog logrus.FieldLogger, oauthParams OAuthParams) (token *OAuthToken, err fault.TypedError)
- func (this *OAuthClient) CreateToken(rlog logrus.FieldLogger, scope string) (token *OAuthToken, err error)
- func (this *OAuthClient) GetAuthorizationHeader(rlog logrus.FieldLogger, scope string, mdc *utils2.MDC) (authorizationHeader string, err error)
- func (this *OAuthClient) GetToken(rlog logrus.FieldLogger, scope string) (tokenInfo *OAuthToken, fromCache bool, err error)
- func (this *OAuthClient) InvalidateToken(rlog logrus.FieldLogger, scope string, mdc *utils2.MDC)
- type OAuthParams
- type OAuthToken
- type ParamsTokenInfo
- type TokenInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientSecret ¶
type ErrorCodeResponse ¶
type OAuthClient ¶
type OAuthClient struct {
Scopes map[string]ClientSecret
GrantType string
CheckTokenURL string
GetTokenURL string
RemoveTokenURL string
AuthEnabled bool
Log *logger.Logger
Cache *cache.Cache
HttpClient *resty.Client
}
func (*OAuthClient) CheckToken ¶
func (this *OAuthClient) CheckToken( token string, ) ( *ParamsTokenInfo, fault.TypedError, )
func (*OAuthClient) CreateHMToken ¶ added in v1.1.8
func (this *OAuthClient) CreateHMToken( rlog logrus.FieldLogger, oauthParams OAuthParams, ) ( token *OAuthToken, err fault.TypedError, )
func (*OAuthClient) CreateMToken ¶
func (this *OAuthClient) CreateMToken( rlog logrus.FieldLogger, oauthParams OAuthParams, ) ( token *OAuthToken, err fault.TypedError, )
func (*OAuthClient) CreateToken ¶
func (this *OAuthClient) CreateToken( rlog logrus.FieldLogger, scope string, ) ( token *OAuthToken, err error, )
func (*OAuthClient) GetAuthorizationHeader ¶
func (this *OAuthClient) GetAuthorizationHeader( rlog logrus.FieldLogger, scope string, mdc *utils2.MDC, ) (authorizationHeader string, err error)
func (*OAuthClient) GetToken ¶
func (this *OAuthClient) GetToken( rlog logrus.FieldLogger, scope string, ) ( tokenInfo *OAuthToken, fromCache bool, err error, )
Retrieve OAuthToken Lookup token in cache by scope name If not found then do auth
func (*OAuthClient) InvalidateToken ¶
func (this *OAuthClient) InvalidateToken( rlog logrus.FieldLogger, scope string, mdc *utils2.MDC, )
type OAuthParams ¶
type OAuthToken ¶
type OAuthToken struct {
Access_token string `example:"5COKJFUJPEQN4X0RY1R7AQ"`
Expires_in string `example:"604800"`
Scope string `example:"qrapi"`
Token_type string `example:"Bearer"`
Refresh_token string `example:"MZZCRLXYORO38HWPV7NUKW"`
}
{
"access_token": "MZZCRLXYORO38HWPV7NUKW",
"expires_in": "604800",
"refresh_token": "",
"scope": "payment",
"token_type": "Bearer"
}
type ParamsTokenInfo ¶
type ParamsTokenInfo struct {
ClientID string
PublicID string
Scope string
Access string
AccessExpiresIn time.Duration
Role string
RedirectURI string
AccessCreateAt string
Refresh string
RefreshCreateAt string
RefreshExpiresIn uint64
Params struct {
Amount string
Curency string
InvoiceID string
Mpan string
Msisdn string
Terminal string
}
}
type TokenInfo ¶
type TokenInfo struct {
ClientID string
PublicID string
Scope string
Access string
AccessExpiresIn time.Duration
Role string
RedirectURI string
AccessCreateAt string
Refresh string
RefreshCreateAt string
RefreshExpiresIn uint64
}
{
"ClientID": "test",
"PublicID": "",
"RedirectURI": "",
"Scope": "webapi",
"Access": "1V1FUUGFO9GJZQOZUAMCFA",
"AccessCreateAt": "2019-06-04T16:35:10.688420232+06:00",
"AccessExpiresIn": 7200000000000,
"Refresh": "",
"RefreshCreateAt": "0001-01-01T00:00:00Z",
"RefreshExpiresIn": 0
}
Click to show internal directories.
Click to hide internal directories.