oaut_client

package
v1.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientSecret

type ClientSecret struct {
	ClientID     string
	ClientSecret string
	Scope        string
	GrantType    string
	Enable       string
}

type ErrorCodeResponse

type ErrorCodeResponse struct {
	Code    int64
	Message string
}

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 OAuthParams struct {
	Grant_type    string
	Scope         string
	Client_id     string
	Client_secret string
	Extention     map[string]string
}

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL