auth

package
v0.0.0-...-c4c90f7 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: Apache-2.0 Imports: 5 Imported by: 4

Documentation

Index

Constants

View Source
const HK_AUTHORIZATION = "Authorization"
View Source
const HK_CONTENT_MD5 = "X-Xiaomi-Content-MD5"
View Source
const HK_HOST = "Host"
View Source
const HK_MAC_ALGORITHM = "X-Xiaomi-Mac-Algorithm"
View Source
const HK_SECRET_KEY = "X-Xiaomi-Secret-Key"
View Source
const HK_SECRET_KEY_ID = "X-Xiaomi-Secret-Key-Id"
View Source
const HK_SIGNATURE = "X-Xiaomi-Signature"
View Source
const HK_SUPPORT_ACCOUNT_KEY = "X-Xiaomi-Support-Account-Key"
View Source
const HK_TIMESTAMP = "X-Xiaomi-Timestamp"
View Source
const HK_USER_TYPE = "X-Xiaomi-User-Type"
View Source
const HK_VERSION = "X-Xiaomi-Version"
View Source
const MI_DATE = "x-xiaomi-date"
View Source
const XIAOMI_HEADER_PREFIX = "x-xiaomi-"

Variables

View Source
var CreateCredentialResult_Se_DEFAULT *errors.ServiceException
View Source
var Credential_SecretKeyId_DEFAULT string
View Source
var Credential_SecretKey_DEFAULT string
View Source
var GoUnusedProtection__ int
View Source
var HttpAuthorizationHeader_SecretKeyId_DEFAULT string
View Source
var HttpAuthorizationHeader_SecretKey_DEFAULT string
View Source
var HttpAuthorizationHeader_Signature_DEFAULT string
View Source
var HttpAuthorizationHeader_SignedHeaders_DEFAULT []string = []string{}
View Source
var HttpAuthorizationHeader_SupportAccountKey_DEFAULT bool = false
View Source
var HttpAuthorizationHeader_Version_DEFAULT string = "SDS-V1"
View Source
var OAuthInfo_AccessToken_DEFAULT string
View Source
var OAuthInfo_MacAlgorithm_DEFAULT string
View Source
var OAuthInfo_MacKey_DEFAULT string
View Source
var OAuthInfo_OpenId_DEFAULT string
View Source
var SIGNATURE_SUPPORT map[UserType]bool
View Source
var SUGGESTED_SIGNATURE_HEADERS []string

Functions

This section is empty.

Types

type AppUserAuthProvider

type AppUserAuthProvider int64

第三方身份认证提供方,用于认证应用用户(非开发者)。 目前提供小米SSO和几种常见OAuth系统

const (
	AppUserAuthProvider_XIAOMI_SSO   AppUserAuthProvider = 1
	AppUserAuthProvider_XIAOMI_OAUTH AppUserAuthProvider = 2
	AppUserAuthProvider_QQ_OAUTH     AppUserAuthProvider = 3
	AppUserAuthProvider_SINA_OAUTH   AppUserAuthProvider = 4
	AppUserAuthProvider_RENREN_OAUTH AppUserAuthProvider = 5
	AppUserAuthProvider_WEIXIN_OAUTH AppUserAuthProvider = 6
)

func AppUserAuthProviderFromString

func AppUserAuthProviderFromString(s string) (AppUserAuthProvider, error)

func AppUserAuthProviderPtr

func AppUserAuthProviderPtr(v AppUserAuthProvider) *AppUserAuthProvider

func (AppUserAuthProvider) String

func (p AppUserAuthProvider) String() string

type AuthService

type AuthService interface {
	common.BaseService

	// 通过第三方认证系统换发Storage Access Token,采用App Secret登录无需此过程
	//
	// Parameters:
	//  - OauthInfo
	CreateCredential(oauthInfo *OAuthInfo) (r *Credential, err error)
}

type AuthServiceClient

type AuthServiceClient struct {
	*common.BaseServiceClient
}

结构化存储授权相关接口(目前尚未开放)

func NewAuthServiceClientProtocol

func NewAuthServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *AuthServiceClient

func (*AuthServiceClient) CreateCredential

func (p *AuthServiceClient) CreateCredential(oauthInfo *OAuthInfo) (r *Credential, err error)

通过第三方认证系统换发Storage Access Token,采用App Secret登录无需此过程

Parameters:

  • OauthInfo

type AuthServiceProcessor

type AuthServiceProcessor struct {
	*common.BaseServiceProcessor
}

func NewAuthServiceProcessor

func NewAuthServiceProcessor(handler AuthService) *AuthServiceProcessor

type CreateCredentialArgs

type CreateCredentialArgs struct {
	OauthInfo *OAuthInfo `thrift:"oauthInfo,1" json:"oauthInfo"`
}

func NewCreateCredentialArgs

func NewCreateCredentialArgs() *CreateCredentialArgs

func (*CreateCredentialArgs) GetOauthInfo

func (p *CreateCredentialArgs) GetOauthInfo() *OAuthInfo

func (*CreateCredentialArgs) IsSetOauthInfo

func (p *CreateCredentialArgs) IsSetOauthInfo() bool

func (*CreateCredentialArgs) Read

func (p *CreateCredentialArgs) Read(iprot thrift.TProtocol) error

func (*CreateCredentialArgs) ReadField1

func (p *CreateCredentialArgs) ReadField1(iprot thrift.TProtocol) error

func (*CreateCredentialArgs) String

func (p *CreateCredentialArgs) String() string

func (*CreateCredentialArgs) Write

func (p *CreateCredentialArgs) Write(oprot thrift.TProtocol) error

type CreateCredentialResult

type CreateCredentialResult struct {
	Success *Credential              `thrift:"success,0" json:"success"`
	Se      *errors.ServiceException `thrift:"se,1" json:"se"`
}

func NewCreateCredentialResult

func NewCreateCredentialResult() *CreateCredentialResult

func (*CreateCredentialResult) GetSe

func (*CreateCredentialResult) GetSuccess

func (p *CreateCredentialResult) GetSuccess() *Credential

func (*CreateCredentialResult) IsSetSe

func (p *CreateCredentialResult) IsSetSe() bool

func (*CreateCredentialResult) IsSetSuccess

func (p *CreateCredentialResult) IsSetSuccess() bool

func (*CreateCredentialResult) Read

func (*CreateCredentialResult) ReadField0

func (p *CreateCredentialResult) ReadField0(iprot thrift.TProtocol) error

func (*CreateCredentialResult) ReadField1

func (p *CreateCredentialResult) ReadField1(iprot thrift.TProtocol) error

func (*CreateCredentialResult) String

func (p *CreateCredentialResult) String() string

func (*CreateCredentialResult) Write

func (p *CreateCredentialResult) Write(oprot thrift.TProtocol) error

type Credential

type Credential struct {
	TypeA1      *UserType `thrift:"type,1" json:"type"`
	SecretKeyId *string   `thrift:"secretKeyId,2" json:"secretKeyId"`
	SecretKey   *string   `thrift:"secretKey,3" json:"secretKey"`
}
var CreateCredentialResult_Success_DEFAULT *Credential

func NewCredential

func NewCredential() *Credential

func (*Credential) GetSecretKey

func (p *Credential) GetSecretKey() string

func (*Credential) GetSecretKeyId

func (p *Credential) GetSecretKeyId() string

func (*Credential) GetTypeA1

func (p *Credential) GetTypeA1() UserType

func (*Credential) IsSetSecretKey

func (p *Credential) IsSetSecretKey() bool

func (*Credential) IsSetSecretKeyId

func (p *Credential) IsSetSecretKeyId() bool

func (*Credential) IsSetTypeA1

func (p *Credential) IsSetTypeA1() bool

func (*Credential) Read

func (p *Credential) Read(iprot thrift.TProtocol) error

func (*Credential) ReadField1

func (p *Credential) ReadField1(iprot thrift.TProtocol) error

func (*Credential) ReadField2

func (p *Credential) ReadField2(iprot thrift.TProtocol) error

func (*Credential) ReadField3

func (p *Credential) ReadField3(iprot thrift.TProtocol) error

func (*Credential) String

func (p *Credential) String() string

func (*Credential) Write

func (p *Credential) Write(oprot thrift.TProtocol) error

type HttpAuthorizationHeader

type HttpAuthorizationHeader struct {
	Version           string        `thrift:"version,1" json:"version"`
	UserType          UserType      `thrift:"userType,2" json:"userType"`
	SecretKeyId       *string       `thrift:"secretKeyId,3" json:"secretKeyId"`
	SecretKey         *string       `thrift:"secretKey,4" json:"secretKey"`
	Signature         *string       `thrift:"signature,5" json:"signature"`
	Algorithm         *MacAlgorithm `thrift:"algorithm,6" json:"algorithm"`
	SignedHeaders     *[]string     `thrift:"signedHeaders,7" json:"signedHeaders"`
	SupportAccountKey bool          `thrift:"supportAccountKey,8" json:"supportAccountKey"`
}

func NewHttpAuthorizationHeader

func NewHttpAuthorizationHeader() *HttpAuthorizationHeader

func (*HttpAuthorizationHeader) GetAlgorithm

func (p *HttpAuthorizationHeader) GetAlgorithm() MacAlgorithm

func (*HttpAuthorizationHeader) GetSecretKey

func (p *HttpAuthorizationHeader) GetSecretKey() string

func (*HttpAuthorizationHeader) GetSecretKeyId

func (p *HttpAuthorizationHeader) GetSecretKeyId() string

func (*HttpAuthorizationHeader) GetSignature

func (p *HttpAuthorizationHeader) GetSignature() string

func (*HttpAuthorizationHeader) GetSignedHeaders

func (p *HttpAuthorizationHeader) GetSignedHeaders() []string

func (*HttpAuthorizationHeader) GetSupportAccountKey

func (p *HttpAuthorizationHeader) GetSupportAccountKey() bool

func (*HttpAuthorizationHeader) GetUserType

func (p *HttpAuthorizationHeader) GetUserType() UserType

func (*HttpAuthorizationHeader) GetVersion

func (p *HttpAuthorizationHeader) GetVersion() string

func (*HttpAuthorizationHeader) IsSetAlgorithm

func (p *HttpAuthorizationHeader) IsSetAlgorithm() bool

func (*HttpAuthorizationHeader) IsSetSecretKey

func (p *HttpAuthorizationHeader) IsSetSecretKey() bool

func (*HttpAuthorizationHeader) IsSetSecretKeyId

func (p *HttpAuthorizationHeader) IsSetSecretKeyId() bool

func (*HttpAuthorizationHeader) IsSetSignature

func (p *HttpAuthorizationHeader) IsSetSignature() bool

func (*HttpAuthorizationHeader) IsSetSignedHeaders

func (p *HttpAuthorizationHeader) IsSetSignedHeaders() bool

func (*HttpAuthorizationHeader) IsSetSupportAccountKey

func (p *HttpAuthorizationHeader) IsSetSupportAccountKey() bool

func (*HttpAuthorizationHeader) IsSetUserType

func (p *HttpAuthorizationHeader) IsSetUserType() bool

func (*HttpAuthorizationHeader) IsSetVersion

func (p *HttpAuthorizationHeader) IsSetVersion() bool

func (*HttpAuthorizationHeader) Read

func (*HttpAuthorizationHeader) ReadField1

func (p *HttpAuthorizationHeader) ReadField1(iprot thrift.TProtocol) error

func (*HttpAuthorizationHeader) ReadField2

func (p *HttpAuthorizationHeader) ReadField2(iprot thrift.TProtocol) error

func (*HttpAuthorizationHeader) ReadField3

func (p *HttpAuthorizationHeader) ReadField3(iprot thrift.TProtocol) error

func (*HttpAuthorizationHeader) ReadField4

func (p *HttpAuthorizationHeader) ReadField4(iprot thrift.TProtocol) error

func (*HttpAuthorizationHeader) ReadField5

func (p *HttpAuthorizationHeader) ReadField5(iprot thrift.TProtocol) error

func (*HttpAuthorizationHeader) ReadField6

func (p *HttpAuthorizationHeader) ReadField6(iprot thrift.TProtocol) error

func (*HttpAuthorizationHeader) ReadField7

func (p *HttpAuthorizationHeader) ReadField7(iprot thrift.TProtocol) error

func (*HttpAuthorizationHeader) ReadField8

func (p *HttpAuthorizationHeader) ReadField8(iprot thrift.TProtocol) error

func (*HttpAuthorizationHeader) String

func (p *HttpAuthorizationHeader) String() string

func (*HttpAuthorizationHeader) Write

type MacAlgorithm

type MacAlgorithm int64

签名使用的HMMAC算法

const (
	MacAlgorithm_HmacMD5    MacAlgorithm = 1
	MacAlgorithm_HmacSHA1   MacAlgorithm = 2
	MacAlgorithm_HmacSHA256 MacAlgorithm = 3
)
var HttpAuthorizationHeader_Algorithm_DEFAULT MacAlgorithm

func MacAlgorithmFromString

func MacAlgorithmFromString(s string) (MacAlgorithm, error)

func MacAlgorithmPtr

func MacAlgorithmPtr(v MacAlgorithm) *MacAlgorithm

func (MacAlgorithm) String

func (p MacAlgorithm) String() string

type OAuthInfo

type OAuthInfo struct {
	XiaomiAppId         string              `thrift:"xiaomiAppId,1" json:"xiaomiAppId"`
	AppUserAuthProvider AppUserAuthProvider `thrift:"appUserAuthProvider,2" json:"appUserAuthProvider"`
	AccessToken         *string             `thrift:"accessToken,3" json:"accessToken"`
	OpenId              *string             `thrift:"openId,4" json:"openId"`
	MacKey              *string             `thrift:"macKey,5" json:"macKey"`
	MacAlgorithm        *string             `thrift:"macAlgorithm,6" json:"macAlgorithm"`
}
var CreateCredentialArgs_OauthInfo_DEFAULT *OAuthInfo

func NewOAuthInfo

func NewOAuthInfo() *OAuthInfo

func (*OAuthInfo) GetAccessToken

func (p *OAuthInfo) GetAccessToken() string

func (*OAuthInfo) GetAppUserAuthProvider

func (p *OAuthInfo) GetAppUserAuthProvider() AppUserAuthProvider

func (*OAuthInfo) GetMacAlgorithm

func (p *OAuthInfo) GetMacAlgorithm() string

func (*OAuthInfo) GetMacKey

func (p *OAuthInfo) GetMacKey() string

func (*OAuthInfo) GetOpenId

func (p *OAuthInfo) GetOpenId() string

func (*OAuthInfo) GetXiaomiAppId

func (p *OAuthInfo) GetXiaomiAppId() string

func (*OAuthInfo) IsSetAccessToken

func (p *OAuthInfo) IsSetAccessToken() bool

func (*OAuthInfo) IsSetMacAlgorithm

func (p *OAuthInfo) IsSetMacAlgorithm() bool

func (*OAuthInfo) IsSetMacKey

func (p *OAuthInfo) IsSetMacKey() bool

func (*OAuthInfo) IsSetOpenId

func (p *OAuthInfo) IsSetOpenId() bool

func (*OAuthInfo) Read

func (p *OAuthInfo) Read(iprot thrift.TProtocol) error

func (*OAuthInfo) ReadField1

func (p *OAuthInfo) ReadField1(iprot thrift.TProtocol) error

func (*OAuthInfo) ReadField2

func (p *OAuthInfo) ReadField2(iprot thrift.TProtocol) error

func (*OAuthInfo) ReadField3

func (p *OAuthInfo) ReadField3(iprot thrift.TProtocol) error

func (*OAuthInfo) ReadField4

func (p *OAuthInfo) ReadField4(iprot thrift.TProtocol) error

func (*OAuthInfo) ReadField5

func (p *OAuthInfo) ReadField5(iprot thrift.TProtocol) error

func (*OAuthInfo) ReadField6

func (p *OAuthInfo) ReadField6(iprot thrift.TProtocol) error

func (*OAuthInfo) String

func (p *OAuthInfo) String() string

func (*OAuthInfo) Write

func (p *OAuthInfo) Write(oprot thrift.TProtocol) error

type UserType

type UserType int64

小米存储系统认证信息类型

const (
	UserType_DEV_XIAOMI_SSO   UserType = 1
	UserType_DEV_XIAOMI       UserType = 2
	UserType_APP_SECRET       UserType = 10
	UserType_APP_ACCESS_TOKEN UserType = 11
	UserType_APP_XIAOMI_SSO   UserType = 12
	UserType_APP_ANONYMOUS    UserType = 13
)
var Credential_TypeA1_DEFAULT UserType
var HttpAuthorizationHeader_UserType_DEFAULT UserType = 13

func UserTypeFromString

func UserTypeFromString(s string) (UserType, error)

func UserTypePtr

func UserTypePtr(v UserType) *UserType

func (UserType) String

func (p UserType) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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