Documentation ¶
Index ¶
- Variables
- func NewCallbackHandler(cfg *oauth2.Config, ckCfg *autho.CookieConfig, ...) http.Handler
- func NewLoginHandler(cfg *oauth2.Config, ckCfg *autho.CookieConfig) http.Handler
- func NewTokenHandler(cfg *oauth2.Config, ckCfg *autho.CookieConfig, ...) http.Handler
- func NewUserHandler(cfg *oauth2.Config, errHandler, terminalHandler http.Handler) http.Handler
- type Email
- type User
Constants ¶
This section is empty.
Variables ¶
var Endpoint *oauth2.Endpoint = &oauth2.Endpoint{
AuthURL: "https://bitly.com/oauth/authorize",
TokenURL: "https://api-ssl.bitly.com/oauth/access_token",
}
Functions ¶
func NewCallbackHandler ¶
func NewCallbackHandler(cfg *oauth2.Config, ckCfg *autho.CookieConfig, errHandler, terminalHandler http.Handler) http.Handler
NewCallbackHandler is a helper function that constructs a new callback handler using the default token handler bitly.NewTokenHandler() wrapped arround the default bitly.NewUserHandler().
This method saves allot of boilerplate. For more customisable handlers construct your own callback handler by wrapping your own specific token handler around your own specific user handler.
func NewLoginHandler ¶
NewLoginHandler creates a new LoginHandler which is resposible for setting a random value (state) to the state cookie. Afterwards the login handler is also responsible for redirecting the user to the provider for the users grant.
func NewTokenHandler ¶
func NewTokenHandler(cfg *oauth2.Config, ckCfg *autho.CookieConfig, errHandler, callbackHandler http.Handler) http.Handler
NewTokenHandler creates a new TokenHandler which is the first handler in the chain responding to the callback from the provider, it is responsible for parsing the response for auth code and state then comparing the cookie state with the request state. Following the parsing the TokenHandler performs the token exchange and adds the token to the request context, calling on success the UserHandler.
Types ¶
type Email ¶
type Email struct { Email string `json:"email"` IsPrimary string `json:"is_primary"` IsVerified string `json:"is_verified"` }
Email represents an email on the users account.
type User ¶
type User struct { Login string `json:"login"` Name string `json:"name"` IsActive bool `json:"is_active"` Created string `json:"created"` Modified string `json:"modified"` IsSSOUser bool `json:"is_sso_user"` Emails []*Email `json:"emails"` Is2FAEnabled bool `json:"is_2fa_enabled"` DefaultGroupGuid string `json:"default_group_guid"` }
User represents fields accessible on a bitly account.