Documentation ¶
Index ¶
- Constants
- type DefaultGeneralVerifier
- type DemoVerifier
- type DemoVerifierParams
- type DiscordAuthResponse
- type DiscordVerifier
- type DiscordVerifierParams
- type FacebookAuthResponse
- type FacebookVerifier
- type FacebookVerifierParams
- type GeneralVerifier
- type GoogleAuthResponse
- type GoogleVerifier
- type GoogleVerifierParams
- type RedditAuthResponse
- type RedditVerifier
- type RedditVerifierParams
- type TestVerifier
- type TestVerifierParams
- type TorusRequest
- type TorusVerifier
- type TorusVerifierParams
- type TwitchAuthResponse
- type TwitchVerifier
- type TwitchVerifierParams
- type Verifier
- type VerifierDetails
- type VerifierDetailsID
- type VerifyMessage
Constants ¶
const GoogleOAuthEndpoint = "https://www.googleapis.com/oauth2/v3"
GoogleOAuthEndpoint - endpoint for checking tokens
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultGeneralVerifier ¶
DefaultGeneralVerifier is the defualt general verifier that is used
func (*DefaultGeneralVerifier) ListVerifiers ¶
func (tgv *DefaultGeneralVerifier) ListVerifiers() []string
ListVerifiers gets List of Registered Verifiers
func (*DefaultGeneralVerifier) Lookup ¶
func (tgv *DefaultGeneralVerifier) Lookup(verifierIdentifier string) (Verifier, error)
Lookup returns the appropriate verifier
func (*DefaultGeneralVerifier) Verify ¶
func (tgv *DefaultGeneralVerifier) Verify(rawMessage *bijson.RawMessage) (bool, string, error)
Verify reroutes the json request to the appropriate sub-verifier within generalVerifier Returns result, verifierID and error
type DemoVerifier ¶
func (*DemoVerifier) CleanToken ¶
func (v *DemoVerifier) CleanToken(token string) string
CleanToken - ensure that incoming token conforms to strict format to prevent replay attacks
func (*DemoVerifier) GetIdentifier ¶
func (v *DemoVerifier) GetIdentifier() string
GetIdentifier - return identifier string for verifier
func (*DemoVerifier) VerifyRequestIdentity ¶
func (v *DemoVerifier) VerifyRequestIdentity(jsonToken *bijson.RawMessage) (bool, string, error)
VerifyRequestIdentity - verifies identity of user based on their token
type DemoVerifierParams ¶
type DiscordAuthResponse ¶
type DiscordVerifier ¶
func NewDiscordVerifier ¶
func NewDiscordVerifier() *DiscordVerifier
func (*DiscordVerifier) CleanToken ¶
func (d *DiscordVerifier) CleanToken(token string) string
func (*DiscordVerifier) GetIdentifier ¶
func (d *DiscordVerifier) GetIdentifier() string
func (*DiscordVerifier) VerifyRequestIdentity ¶
func (d *DiscordVerifier) VerifyRequestIdentity(rawPayload *bijson.RawMessage) (bool, string, error)
type DiscordVerifierParams ¶
type FacebookAuthResponse ¶
type FacebookAuthResponse struct { Data struct { AppId string `json:"app_id,omitempty"` Application string `json:"application,omitempty"` DataAccessExpiresAt int `json:"data_access_expiers_at,omitempty"` Error *struct { Code int `json:"code"` Message string `json:"message"` } `json:"error,omitempty"` ExpiresAt int `json:"expires_at,omitempty"` IsValid bool `json:"is_valid"` Scopes []string `json:"scopes"` Type string `json:"type,omitempty"` UserID string `json:"user_id,omitempty"` } `json:"data"` }
type FacebookVerifier ¶
type FacebookVerifier struct{}
func NewFacebookVerifier ¶
func NewFacebookVerifier() *FacebookVerifier
func (*FacebookVerifier) CleanToken ¶
func (f *FacebookVerifier) CleanToken(token string) string
func (*FacebookVerifier) GetIdentifier ¶
func (f *FacebookVerifier) GetIdentifier() string
func (*FacebookVerifier) VerifyRequestIdentity ¶
func (f *FacebookVerifier) VerifyRequestIdentity(rawPayload *bijson.RawMessage) (bool, string, error)
type FacebookVerifierParams ¶
type GeneralVerifier ¶
type GeneralVerifier interface { ListVerifiers() []string Verify(*bijson.RawMessage) (verified bool, verifierID string, err error) Lookup(string) (Verifier, error) }
GeneralVerifier accepts an identifier string and returns an IdentityVerifier
func NewGeneralVerifier ¶
func NewGeneralVerifier(verifiers []Verifier) GeneralVerifier
NewGeneralVerifier - Initialization function for a generic GeneralVerifier
type GoogleAuthResponse ¶
type GoogleAuthResponse struct { Azp string `json:"azp"` Email string `json:"email"` Iss string `json:"iss"` Aud string `json:"aud"` Sub string `json:"sub"` EmailVerified string `json:"email_verified"` AtHash string `json:"at_hash"` Name string `json:"name"` Picture string `json:"picture"` GivenName string `json:"given_name"` Locale string `json:"locale"` Iat string `json:"iat"` Exp string `json:"exp"` Jti string `json:"jti"` Alg string `json:"alg"` Kid string `json:"kid"` Typ string `json:"typ"` }
GoogleAuthResponse - expected response body from google endpoint when checking submitted token
type GoogleVerifier ¶
GoogleVerifier - Google verifier details
func NewGoogleVerifier ¶
func NewGoogleVerifier() *GoogleVerifier
NewGoogleVerifier - Constructor for the default google verifier
func (*GoogleVerifier) CleanToken ¶
func (g *GoogleVerifier) CleanToken(token string) string
CleanToken - trim spaces to prevent replay attacks
func (*GoogleVerifier) GetIdentifier ¶
func (g *GoogleVerifier) GetIdentifier() string
GetIdentifier - get identifier string for verifier
func (*GoogleVerifier) VerifyRequestIdentity ¶
func (g *GoogleVerifier) VerifyRequestIdentity(rawPayload *bijson.RawMessage) (bool, string, error)
VerifyRequestIdentity - verifies identity of user based on their token
type GoogleVerifierParams ¶
type GoogleVerifierParams struct { IDToken string `json:"idtoken"` VerifierID string `json:"verifier_id"` }
GoogleVerifierParams - expected params for the google verifier
type RedditAuthResponse ¶
type RedditVerifier ¶
type RedditVerifier struct{}
func NewRedditVerifier ¶
func NewRedditVerifier() *RedditVerifier
func (*RedditVerifier) CleanToken ¶
func (r *RedditVerifier) CleanToken(token string) string
func (*RedditVerifier) GetIdentifier ¶
func (r *RedditVerifier) GetIdentifier() string
func (*RedditVerifier) VerifyRequestIdentity ¶
func (r *RedditVerifier) VerifyRequestIdentity(rawPayload *bijson.RawMessage) (bool, string, error)
type RedditVerifierParams ¶
type TestVerifier ¶
type TestVerifier struct {
CorrectIDToken string
}
func NewTestVerifier ¶
func NewTestVerifier(correctIDToken string) *TestVerifier
NewTestVerifier - Constructor for the default test verifier
func (*TestVerifier) CleanToken ¶
func (v *TestVerifier) CleanToken(token string) string
CleanToken - ensure that incoming token conforms to strict format to prevent replay attacks
func (*TestVerifier) GetIdentifier ¶
func (v *TestVerifier) GetIdentifier() string
GetIdentifier - return identifier string for verifier
func (*TestVerifier) VerifyRequestIdentity ¶
func (v *TestVerifier) VerifyRequestIdentity(jsonToken *bijson.RawMessage) (bool, string, error)
VerifyRequestIdentity - verifies identity of user based on their token
type TestVerifierParams ¶
type TorusRequest ¶
type TorusVerifier ¶
func NewTorusVerifier ¶
func NewTorusVerifier() *TorusVerifier
func (*TorusVerifier) CleanToken ¶
func (t *TorusVerifier) CleanToken(token string) string
func (*TorusVerifier) GetIdentifier ¶
func (t *TorusVerifier) GetIdentifier() string
func (*TorusVerifier) VerifyRequestIdentity ¶
func (t *TorusVerifier) VerifyRequestIdentity(rawPayload *bijson.RawMessage) (bool, string, error)
type TorusVerifierParams ¶
type TwitchAuthResponse ¶
type TwitchVerifier ¶
func NewTwitchVerifier ¶
func NewTwitchVerifier() *TwitchVerifier
func (*TwitchVerifier) CleanToken ¶
func (t *TwitchVerifier) CleanToken(token string) string
func (*TwitchVerifier) GetIdentifier ¶
func (t *TwitchVerifier) GetIdentifier() string
func (*TwitchVerifier) VerifyRequestIdentity ¶
func (t *TwitchVerifier) VerifyRequestIdentity(rawPayload *bijson.RawMessage) (bool, string, error)
type TwitchVerifierParams ¶
type Verifier ¶
type Verifier interface { GetIdentifier() string CleanToken(string) string VerifyRequestIdentity(*bijson.RawMessage) (verified bool, verifierID string, err error) }
Verifier describes verification of a token, without checking for token uniqueness
type VerifierDetails ¶
func (*VerifierDetails) FromVerifierDetailsID ¶
func (v *VerifierDetails) FromVerifierDetailsID(vID VerifierDetailsID) error
func (*VerifierDetails) ToVerifierDetailsID ¶
func (v *VerifierDetails) ToVerifierDetailsID() VerifierDetailsID
type VerifierDetailsID ¶
type VerifierDetailsID string