auth

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 9 Imported by: 1

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

func VerifyUserV2 added in v1.9.1

func VerifyUserV2(ctx context.Context, filters map[string]string, clientCode string, cli *http.Client) (string, error)

pass filters (including clientCode and sessionKey), pass client code, context and http client

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 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"`
	CustomerRegistryURLs []struct {
		Priority int64  `json:"priority"`
		Token    string `json:"token"`
		URL      string `json:"url"`
		Weight   int64  `json:"weight"`
	} `json:"customerRegistryURLs"`
}

func GetSessionKeyUser

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

GetSessionKeyUser returns user information for the used session key

func SwitchUser added in v1.9.1

func SwitchUser(ctx context.Context, sessionKey, pin, clientCode string, inputParams map[string]string, cli *http.Client) (*SessionKeyUser, error)

SwitchUser executes the Erply API SwitchUser call and returns an object containing most of the resulting data. If it is necessary to specify the length of the created session or pass some other additional parameters to the underlying Erply API call, this can be done using the inputParams map.

func VerifyUserFull added in v1.9.1

func VerifyUserFull(ctx context.Context, username, password, clientCode string, inputParams map[string]string, cli *http.Client) (*SessionKeyUser, error)

VerifyUserFull executes the Erply API VerifyUser call and returns an object containing most of the resulting data. If it is necessary to specify the length of the created session or pass some other additional parameters to the underlying Erply API call, this can be done using the inputParams map.

type SessionKeyUserResponse

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

type SwitchUserResponse added in v1.9.1

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

type VerifyUserResponse

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

func VerifyUserV3 added in v1.9.1

func VerifyUserV3(ctx context.Context, filters map[string]string, clientCode string, cli *http.Client) (*VerifyUserResponse, error)

Jump to

Keyboard shortcuts

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