oauth

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessTokenCookieKey

func AccessTokenCookieKey() string

func AccessTokenExpirationCookieKey

func AccessTokenExpirationCookieKey() string

func AccessTokenHeaderKey

func AccessTokenHeaderKey() string

func GetAccessToken

func GetAccessToken(ctx context.Context) (string, error)

func RefreshTokenCookieKey

func RefreshTokenCookieKey() string

Types

type Authenticator

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

func NewAuthenticator

func NewAuthenticator(oauthRedirectUrl string, oauthClientSecret string, oauthClientID string, oauthStateKey string, cookiePath string) *Authenticator

func (*Authenticator) GetTokenCookiesFromAuthToken

func (a *Authenticator) GetTokenCookiesFromAuthToken(ctx context.Context, authorizationToken string, sc *securecookie.SecureCookie) ([]*http.Cookie, error)

func (*Authenticator) RefreshTokenConsentUrl

func (a *Authenticator) RefreshTokenConsentUrl() string

func (*Authenticator) TrySetCookieAuthContext

TrySetCookieAuthContext - gqlgen gives us the context in the resolver, but does not expose any way to alter it midflight specifically, the generated handler functions hand off a context to the resolver, and then hand the same context to the marshaller. so we're doing everything before it gets there. this means that even requests that don't NEED an access token will have it refreshed when expired. Given this is only every 30 minutes per user, it's not the worst. But given we don't plan to be harsh on view access, it's unavoidable major overkill.

func (*Authenticator) TrySetHeaderAuthContext

func (a *Authenticator) TrySetHeaderAuthContext(request *http.Request) (*http.Request, bool)

Jump to

Keyboard shortcuts

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