Documentation ¶
Overview ¶
Package alipay implements the OAuth2 protocol for authenticating users through Alipay. This package can be used as a reference implementation of an OAuth2 provider for Goth.
Index ¶
- Variables
- func RSADecrypt(ciphertext, key []byte) ([]byte, error)
- func RSAEncrypt(plaintext, key []byte) ([]byte, error)
- func SignRSA(param url.Values, privateKey *rsa.PrivateKey) (string, error)
- func SignRSA2(param url.Values, privateKey *rsa.PrivateKey) (string, error)
- func SignRSAx(param url.Values, privateKey *rsa.PrivateKey, hash crypto.Hash) (string, error)
- func VerifyResponseData(data []byte, signType, sign string, key []byte) error
- func VerifySign(val url.Values, key []byte) error
- type Provider
- func (p *Provider) BeginAuth(state string) (goth.Session, error)
- func (p *Provider) Client() *http.Client
- func (p *Provider) Debug(debug bool)
- func (p *Provider) FetchUser(session goth.Session) (goth.User, error)
- func (p *Provider) Name() string
- func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error)
- func (p *Provider) RefreshTokenAvailable() bool
- func (p *Provider) SetName(name string)
- func (p *Provider) UnmarshalSession(data string) (goth.Session, error)
- type Session
Constants ¶
This section is empty.
Variables ¶
var ( SandBoxAuthURL = "https://openauth.alipaydev.com/oauth2/publicAppAuthorize.htm" SandBoxAPIURL = "https://openapi.alipaydev.com/gateway.do" AuthURL = "https://openauth.alipay.com/oauth2/publicAppAuthorize.htm" APIURL = "https://openapi.alipay.com/gateway.do" )
These vars define the Authentication, Token, and API URLS for GitHub. If using GitHub enterprise you should change these values before calling New.
Functions ¶
func RSADecrypt ¶
func RSAEncrypt ¶
func VerifyResponseData ¶
Types ¶
type Provider ¶
type Provider struct { ClientKey string Secret string CallbackURL string HTTPClient *http.Client // contains filtered or unexported fields }
Provider is the implementation of `goth.Provider` for accessing Github.
func New ¶
New creates a new Github provider, and sets up important connection details. You should always call `github.New` to get a new Provider. Never try to create one manually.
func NewCustomisedURL ¶
func NewCustomisedURL(clientKey, privateKey, callbackURL, authURL string, apiURL string, scopes ...string) *Provider
NewCustomisedURL is similar to New(...) but can be used to set custom URLs to connect to
func (*Provider) BeginAuth ¶
BeginAuth asks Github for an authentication end-point. documentation https://opensupport.alipay.com/support/helpcenter/166/201602504335?ant_source=zsearch#
func (*Provider) FetchUser ¶
FetchUser will go to Github and access basic information about the user. documentation https://opendocs.alipay.com/apis/api_2/alipay.user.info.share
func (*Provider) RefreshToken ¶
RefreshToken refresh token is not provided by QQ
func (*Provider) RefreshTokenAvailable ¶
RefreshTokenAvailable refresh token is not provided by QQ
type Session ¶
type Session struct { AuthURL string AccessToken string RefreshToken string OpenID string Expiry time.Time }
Session stores data during the auth process with QQ.
func (*Session) Authorize ¶
Authorize the session with Github and return the access token to be stored for future use. ?state=state&app_id=hide&source=alipay_wallet&userOutputs=auth_user&scope=auth_user&alipay_token=&auth_code=7b7022f35fff49b896d0251bc763VX39 documentation https://opendocs.alipay.com/apis/api_9/alipay.system.oauth.token
func (Session) GetAuthURL ¶
GetAuthURL will return the URL set by calling the `BeginAuth` function on the QQ provider.