oauthorizer

package
v0.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorizer

type Authorizer interface {
	AuthorizeLink(redirectURI string, state string) string
	ParseResponse(r *http.Request, state string) (string, error)
}

func NewAuthorizer

func NewAuthorizer(authURI, clientID string, scopes ...string) Authorizer

type CallbackHandler

type CallbackHandler struct {
	// contains filtered or unexported fields
}

func NewCallbackHandler

func NewCallbackHandler(redirectURL *url.URL, authorizer Authorizer) (CallbackHandler, error)

func (CallbackHandler) AuthorizeURL

func (s CallbackHandler) AuthorizeURL() string

func (CallbackHandler) ListenURL

func (s CallbackHandler) ListenURL() string

func (CallbackHandler) WithAuthorizationCode

func (s CallbackHandler) WithAuthorizationCode(callback func(string) error) error

WithAuthorizationCode executes the provided function with the resulting authorization code or error. Afterwards the user is redirected to the CallbackHandler's baseRedirectURL. If the callback produced an error, the error is appended to the redirect url: &error=<error>. The provided callback function will only be executed once, even if multiple successful callbacks arrive at the server. This function returns when the callback has been executed and the user is redirected.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL