sso

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: MIT Imports: 8 Imported by: 0

README

sso

星耀九州统一登录门户golang sdk

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProductPay

type ProductPay struct {
	ProductUid   string `json:"product_uid" form:"product_uid"`     // 商品uid
	ProductName  string `json:"product_name" form:"product_name"`   // 商品名
	ProductUrl   string `json:"product_url" form:"product_url"`     // 商品url
	ProductPrice uint64 `json:"product_price" form:"product_price"` // 商品价格
	Remark       string `json:"remark" form:"remark"`
}

商品支付

type ProductPayBase added in v1.0.6

type ProductPayBase struct {
	ProductUid   string `json:"product_uid" form:"product_uid"`      // 商品uid
	ProductName  string `json:"product_name" form:"product_name" `   // 商品名 必填
	ProductUrl   string `json:"product_url" form:"product_url" `     // 商品url
	ProductPrice uint64 `json:"product_price" form:"product_price" ` // 商品价格 必填
	Remark       string `json:"remark" form:"remark" `               // 备注
	UserUid      string `json:"user_uid" form:"user_uid" `           // 用户标识符
}

商品支付基础

type ProductPayResp added in v1.0.6

type ProductPayResp struct {
	Order  string `json:"order" form:"order"`
	Detail string `json:"detail" form:"detail"`
}

商品收款返回

type ProductReceipt added in v1.0.6

type ProductReceipt struct {
	ProductPayBase
	SignBase
}

商品收款

type SignBase added in v1.0.6

type SignBase struct {
	Sign      string `json:"sign" form:"sign" url:"sign"`
	RandomStr string `json:"random_str" form:"random_str" url:"random_str"`
	T         string `json:"t" form:"t" url:"t"` // unix时间戳字符串
}

签名请求基础

type Sso added in v1.0.2

type Sso struct {
	Host      string
	PublicKey string
	SecretKey string

	Prefix string
	// contains filtered or unexported fields
}
var (
	Sdk Sso
)

func New

func New(publicKey, secretKey string) Sso

func (*Sso) CheckSign added in v1.0.7

func (c *Sso) CheckSign(sign, randomStr, timeUnix string) bool

验证加密

func (*Sso) GetLoginUrl added in v1.1.0

func (c *Sso) GetLoginUrl() string

GetLoginUrl 获取登录必备参数

func (*Sso) GetVerifyUrl added in v1.0.7

func (c *Sso) GetVerifyUrl() string

GetVerifyUrl 生成核验的url 前端使用iframe post message 获取ticket

func (*Sso) RunTr added in v1.0.6

func (c *Sso) RunTr(data ProductReceipt, receipt bool) (ProductPayResp, error, int)

RunTr 发起交易 receipt 是否是商品收款

func (*Sso) SetHost added in v1.0.3

func (c *Sso) SetHost(host string)

func (*Sso) Sign added in v1.0.8

func (c *Sso) Sign() (string, string, string)

生成一次加密

func (*Sso) TicketGetUser added in v1.0.2

func (c *Sso) TicketGetUser(ticket string) (UserInfo, error)

TicketGetUser 通过ticket获取用户

func (*Sso) UidGetUserInfo added in v1.0.6

func (c *Sso) UidGetUserInfo(uid string) (UserInfo, error)

UidGetUserInfo 通过uid获取用户信息

func (*Sso) UrlGen added in v1.1.0

func (c *Sso) UrlGen(prefix string, p string) string

type TicketGetUserReq added in v1.0.9

type TicketGetUserReq struct {
	Ticket string `json:"ticket"`
	SignBase
}

ticket获取用户

type UserInfo

type UserInfo struct {
	Uid       string `json:"uid"`
	UniqueId  string `json:"unique_id,omitempty"`
	NickName  string `json:"nick_name"`
	AvatarUrl string `json:"avatar_url"`
}

用户信息

type ValidTicketReq

type ValidTicketReq struct {
	Ticket string `json:"ticket"`
}

验证ticket是否有效

Jump to

Keyboard shortcuts

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