Documentation
¶
Index ¶
- Constants
- Variables
- func ExchangeAuthorizationCode(ctx context.Context, httpClient *http.Client, env *environments.EnvironmentSet, ...) (*credentials.CreLoginTokenSet, error)
- func GeneratePKCE() (verifier, challenge string, err error)
- func NewCallbackHTTPServer(listenAddr string, callback http.HandlerFunc) (*http.Server, net.Listener, error)
- func OpenBrowser(urlStr string, goos string) error
- func RandomState() string
- func ServeEmbeddedHTML(log *zerolog.Logger, w http.ResponseWriter, filePath string, status int)
- func ServeWaitingPage(log *zerolog.Logger, w http.ResponseWriter, redirectURL string)
Constants ¶
View Source
const ( PageError = "htmlPages/error.html" PageSuccess = "htmlPages/success.html" PageWaiting = "htmlPages/waiting.html" StylePage = "htmlPages/output.css" )
Variables ¶
View Source
var DefaultHTTPClient = &http.Client{Timeout: 10 * time.Second}
DefaultHTTPClient is used for token exchange when no client is supplied.
Functions ¶
func ExchangeAuthorizationCode ¶
func ExchangeAuthorizationCode(ctx context.Context, httpClient *http.Client, env *environments.EnvironmentSet, code, codeVerifier string) (*credentials.CreLoginTokenSet, error)
ExchangeAuthorizationCode exchanges an OAuth authorization code for tokens using environment credentials (AuthBase, ClientID) and PKCE code_verifier.
func GeneratePKCE ¶
GeneratePKCE returns an RFC 7636 S256 code verifier and code challenge.
func NewCallbackHTTPServer ¶
func NewCallbackHTTPServer(listenAddr string, callback http.HandlerFunc) (*http.Server, net.Listener, error)
NewCallbackHTTPServer listens on listenAddr and serves callback on /callback.
func OpenBrowser ¶
OpenBrowser opens urlStr in the default browser for the given GOOS value.
func RandomState ¶
func RandomState() string
RandomState returns a random OAuth state value for CSRF protection.
func ServeEmbeddedHTML ¶
ServeEmbeddedHTML serves an embedded HTML page with inline CSS.
func ServeWaitingPage ¶
func ServeWaitingPage(log *zerolog.Logger, w http.ResponseWriter, redirectURL string)
ServeWaitingPage serves the waiting page with the redirect URL injected.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.