Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateState ¶
func GenerateState() string
GenerateState generates a state to be supplied in an auth request and to be tested against in the response. It is generated from 20 random bytes, encoded to base64.
Types ¶
type AuthCallbackFunc ¶
type AuthConfig ¶
type Client ¶
type Client struct { Config *ClientConfig Auth *AuthConfig AuthCallback AuthCallbackFunc // contains filtered or unexported fields }
func New ¶
func New(clientConfig *ClientConfig, authConfig *AuthConfig, authCallback AuthCallbackFunc, httpClient *http.Client) *Client
func (*Client) BuildAuthURL ¶
BuildAuthURL builds the URL to navigate to in order to initialize the auth process.
func (*Client) HandleAuthInit ¶
func (cl *Client) HandleAuthInit(w http.ResponseWriter, r *http.Request)
HandleAuthInit shows a very barebone page with a link to start the authentication process. Alternatively, use auth URL from cl.BuildAuthURL() and redirect to it programmatically.
func (*Client) HandleCallback ¶
func (cl *Client) HandleCallback(w http.ResponseWriter, r *http.Request)
HandleCallback handles the returning *http.Request from the Auth server. it will call the AuthCallbackFunc initially supplied with the response data, once validated.
type ClientConfig ¶
type ClientConfig struct { AuthServerURL string AuthServerAuthPath string AuthServerTokenPath string LocalServerURL string LocalServerRedirectPath string Scope string State string }
func (*ClientConfig) IsValid ¶
func (c *ClientConfig) IsValid() bool
Click to show internal directories.
Click to hide internal directories.