auth

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: MIT Imports: 9 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyUser

func VerifyUser(username, password, clientCode string, client *http.Client) (string, error)

VerifyUser will give you session key

Types

type Client

type Client struct{ *common.Client }

func NewClient

func NewClient(client *common.Client) *Client

func (*Client) GetIdentityToken

func (cli *Client) GetIdentityToken(ctx context.Context) (*IdentityToken, error)

GetIdentityToken ...

func (*Client) GetJWTToken

func (cli *Client) GetJWTToken(ctx context.Context) (*JwtToken, error)

GetJWTToken executes the getJWTToken query (https://learn-api.erply.com/requests/getjwttoken).

func (*Client) VerifyIdentityToken

func (cli *Client) VerifyIdentityToken(ctx context.Context, jwt string) (*SessionInfo, error)

VerifyIdentityToken ...

type HttpClient

type HttpClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type IdentityToken

type IdentityToken struct {
	Jwt string `json:"identityToken"`
}

type JwtToken

type JwtToken struct {
	Token string `json:"token"`
}

type JwtTokenResponse

type JwtTokenResponse struct {
	Status  common2.Status `json:"status"`
	Records JwtToken       `json:"records"`
}

type PartnerClient

type PartnerClient struct{ *common.Client }

func NewPartnerClient

func NewPartnerClient(client *common.Client) *PartnerClient

func (*PartnerClient) GetJWTToken

func (cli *PartnerClient) GetJWTToken(ctx context.Context) (*JwtToken, error)

only for partnerClient

type PartnerTokenProvider

type PartnerTokenProvider interface {
	GetJWTToken(ctx context.Context) (*JwtToken, error)
}

interface only for partner tokens

type Provider

type Provider interface {
	VerifyIdentityToken(ctx context.Context, jwt string) (*SessionInfo, error)
	GetIdentityToken(ctx context.Context) (*IdentityToken, error)
	GetJWTToken(ctx context.Context) (*JwtToken, error)
}

type Records

type Records struct {
	SessionKey string `json:"sessionKey"`
}

type SessionInfo

type SessionInfo struct {
	SessionKey string `json:"sessionKey"`
}

type SessionKeyInfo added in v1.7.1

type SessionKeyInfo struct {
	CreationUnixTime string `json:"creationUnixTime"`
	ExpireUnixTime   string `json:"expireUnixTime"`
}

func GetSessionKeyInfo added in v1.7.1

func GetSessionKeyInfo(sessionKey string, clientCode string, client HttpClient) (*SessionKeyInfo, error)

GetSessionKeyInfo returns session key expiration info

type SessionKeyInfoResponse added in v1.7.1

type SessionKeyInfoResponse struct {
	Status  common2.Status   `json:"status"`
	Records []SessionKeyInfo `json:"records"`
}

type SessionKeyUser

type SessionKeyUser struct {
	UserID             string `json:"userID"`
	UserName           string `json:"userName"`
	EmployeeName       string `json:"employeeName"`
	EmployeeID         string `json:"employeeID"`
	GroupID            string `json:"groupID"`
	GroupName          string `json:"groupName"`
	IPAddress          string `json:"ipAddress"`
	SessionKey         string `json:"sessionKey"`
	SessionLength      int    `json:"sessionLength"`
	LoginUrl           string `json:"loginUrl"`
	BerlinPOSVersion   string `json:"berlinPOSVersion"`
	BerlinPOSAssetsURL string `json:"berlinPOSAssetsURL"`
	EpsiURL            string `json:"epsiURL"`
	IdentityToken      string `json:"identityToken"`
	Token              string `json:"token"`
}

func GetSessionKeyUser

func GetSessionKeyUser(sessionKey string, clientCode string, client HttpClient) (*SessionKeyUser, error)

GetSessionKeyUser returns user information for the used session key

type SessionKeyUserResponse

type SessionKeyUserResponse struct {
	Records []SessionKeyUser `json:"records"`
}

type VerifyUserResponse

type VerifyUserResponse struct {
	Records []Records `json:"records"`
}

Jump to

Keyboard shortcuts

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