Documentation ¶
Index ¶
Constants ¶
View Source
const ( LoginCookieName = "X-Gateway-User" LoginHeaderName = "X-Gateway-User" )
Variables ¶
This section is empty.
Functions ¶
func NewLoginCallbackHandler ¶
func NewLoginCallbackHandler( cookieGenerator CookieGenerator, stateGenerator StateGenerator, googleOAuth GoogleOAuth, ) libhttp.WithError
Types ¶
type Cookie ¶
type Cookie struct { jwt.StandardClaims // contains filtered or unexported fields }
Cookie storing the user pass-through information that is passed on authentication.
type CookieGenerator ¶
type CookieGenerator interface { Generate(ctx context.Context, user string) (Cookie, error) Decode(ctx context.Context, cookie string) (Cookie, error) }
CookieGenerator generates and decodes secure cookies
func NewCookieGenerator ¶
func NewCookieGenerator(key []byte) CookieGenerator
NewCookieGenerator using key to sign cookie tokens
type GoogleOAuth ¶
type GoogleOAuth interface { AuthCodeURL(state State) string UserInfo(ctx context.Context, code Code) (*UserInfo, error) }
GoogleOAuth defines the interface used for running a Google OAuth flow
func NewGoogleOAuth ¶
func NewGoogleOAuth( clientID string, clientSecret string, redirectURL string, hostedDomain string, ) GoogleOAuth
NewGoogleOAuth returns an implementation of the Google OAuth flow using the provided credentials
type LoginMiddleware ¶
func NewLoginMiddleware ¶
func NewLoginMiddleware( cookieGenerator CookieGenerator, stateGenerator StateGenerator, googleOAuth GoogleOAuth, callbackPath string, ) LoginMiddleware
NewLoginMiddleware for validating request against a jwt secret
type State ¶
type State struct { Origin string `json:"origin"` jwt.StandardClaims // contains filtered or unexported fields }
State stores a requests state for passing through the oauth2 flow, ensuring CSRF protection and a fluent experience by passing the origin url.
type StateGenerator ¶
type StateGenerator interface { Generate(ctx context.Context, originURL string) (State, error) Decode(ctx context.Context, token string) (State, error) }
StateGenerator generates and decodes secure states
func NewStateGenerator ¶
func NewStateGenerator(key []byte) StateGenerator
NewStateGenerator using key to sign state tokens
Click to show internal directories.
Click to hide internal directories.