Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitHubProvider

type GitHubProvider struct {
	*ProviderData
	Org  string
	Team string
}

func NewGitHubProvider

func NewGitHubProvider(p *ProviderData) *GitHubProvider

func (*GitHubProvider) GetEmailAddress

func (p *GitHubProvider) GetEmailAddress(s *SessionState) (string, error)

func (*GitHubProvider) SetOrgTeam

func (p *GitHubProvider) SetOrgTeam(org, team string)

type GoogleProvider

type GoogleProvider struct {
	*ProviderData
	RedeemRefreshUrl *url.URL
}

func NewGoogleProvider

func NewGoogleProvider(p *ProviderData) *GoogleProvider

func (*GoogleProvider) Redeem

func (p *GoogleProvider) Redeem(redirectUrl, code string) (s *SessionState, err error)

func (*GoogleProvider) RefreshSessionIfNeeded

func (p *GoogleProvider) RefreshSessionIfNeeded(s *SessionState) (bool, error)

type LinkedInProvider

type LinkedInProvider struct {
	*ProviderData
}

func NewLinkedInProvider

func NewLinkedInProvider(p *ProviderData) *LinkedInProvider

func (*LinkedInProvider) GetEmailAddress

func (p *LinkedInProvider) GetEmailAddress(s *SessionState) (string, error)

func (*LinkedInProvider) ValidateSessionState

func (p *LinkedInProvider) ValidateSessionState(s *SessionState) bool

type MyUsaProvider

type MyUsaProvider struct {
	*ProviderData
}

func NewMyUsaProvider

func NewMyUsaProvider(p *ProviderData) *MyUsaProvider

func (*MyUsaProvider) GetEmailAddress

func (p *MyUsaProvider) GetEmailAddress(s *SessionState) (string, error)

type Provider

type Provider interface {
	Data() *ProviderData
	GetEmailAddress(*SessionState) (string, error)
	Redeem(string, string) (*SessionState, error)
	ValidateSessionState(*SessionState) bool
	GetLoginURL(redirectURI, finalRedirect string) string
	RefreshSessionIfNeeded(*SessionState) (bool, error)
	SessionFromCookie(string, *cookie.Cipher) (*SessionState, error)
	CookieForSession(*SessionState, *cookie.Cipher) (string, error)
}

func New

func New(provider string, p *ProviderData) Provider

type ProviderData

type ProviderData struct {
	ProviderName string
	ClientID     string
	ClientSecret string
	LoginUrl     *url.URL
	RedeemUrl    *url.URL
	ProfileUrl   *url.URL
	ValidateUrl  *url.URL
	Scope        string
}

func (*ProviderData) CookieForSession

func (p *ProviderData) CookieForSession(s *SessionState, c *cookie.Cipher) (string, error)

    CookieForSession serializes a session state for storage in a cookie

    func (*ProviderData) Data

    func (p *ProviderData) Data() *ProviderData

    func (*ProviderData) GetEmailAddress

    func (p *ProviderData) GetEmailAddress(s *SessionState) (string, error)

    func (*ProviderData) GetLoginURL

    func (p *ProviderData) GetLoginURL(redirectURI, finalRedirect string) string

      GetLoginURL with typical oauth parameters

      func (*ProviderData) Redeem

      func (p *ProviderData) Redeem(redirectUrl, code string) (s *SessionState, err error)

      func (*ProviderData) RefreshSessionIfNeeded

      func (p *ProviderData) RefreshSessionIfNeeded(s *SessionState) (bool, error)

        RefreshSessionIfNeeded

        func (*ProviderData) SessionFromCookie

        func (p *ProviderData) SessionFromCookie(v string, c *cookie.Cipher) (s *SessionState, err error)

          SessionFromCookie deserializes a session from a cookie value

          func (*ProviderData) ValidateSessionState

          func (p *ProviderData) ValidateSessionState(s *SessionState) bool

          type SessionState

          type SessionState struct {
          	AccessToken  string
          	ExpiresOn    time.Time
          	RefreshToken string
          	Email        string
          	User         string
          }

          func DecodeSessionState

          func DecodeSessionState(v string, c *cookie.Cipher) (s *SessionState, err error)

          func (*SessionState) EncodeSessionState

          func (s *SessionState) EncodeSessionState(c *cookie.Cipher) (string, error)

          func (*SessionState) EncryptedString

          func (s *SessionState) EncryptedString(c *cookie.Cipher) (string, error)

          func (*SessionState) IsExpired

          func (s *SessionState) IsExpired() bool

          func (*SessionState) String

          func (s *SessionState) String() string