Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // CookieExpiration is expiration for JWT cookie CookieExpiration time.Duration = 72 * time.Hour StateExpiration time.Duration = 20 * time.Minute TokenEpiration time.Duration = 72 * time.Hour )
View Source
var (
// DefaultConfigName is default config name of oauth2 google
DefaultConfigName = "OAUTH2_GOOGLE"
)
Functions ¶
Types ¶
type AuthCntrl ¶
type AuthCntrl struct { dig.In *Config AuthService }
AuthCntrl is controller to handle authentication
func (*AuthCntrl) Middleware ¶
func (c *AuthCntrl) Middleware() echo.MiddlewareFunc
Middleware for google social login
func (*AuthCntrl) SetTokenCtxMiddleware ¶
func (c *AuthCntrl) SetTokenCtxMiddleware() echo.MiddlewareFunc
SetTokenCtxMiddleware re-set token to request context for informational purpose (getting username, etc)
type AuthService ¶
type AuthService interface { VerifyCallback(ce echo.Context, jwtSecret string) (string, error) GetAuthCodeURL(ce echo.Context, cookieSecure bool) string }
AuthService is center related logic [mock]
func NewService ¶
func NewService(cfg *Config) AuthService
NewService return new instance of AuthGoogleService
type AuthServiceImpl ¶
AuthServiceImpl implementation of AuthService
func (*AuthServiceImpl) GetAuthCodeURL ¶
func (c *AuthServiceImpl) GetAuthCodeURL(ce echo.Context, cookieSecure bool) (authCodeURL string)
func (*AuthServiceImpl) VerifyCallback ¶
VerifyCallback to add metaTag
type Config ¶
type Config struct { ClientID string `envconfig:"CLIENT_ID" required:"true"` ClientSecret string `envconfig:"CLIENT_SECRET" required:"true"` Callback string `envconfig:"CALLBACK" required:"true"` HostedDomain string `envconfig:"HOSTED_DOMAIN"` CookieSecure bool `envconfig:"COOKIE_SECURE" default:"false"` JWTSecret string `envconfig:"JWT_SECRET"` RedirectSuccess string `envconfig:"REDIRECT_SUCCESS"` RedirectFailure string `envconfig:"REDIRECT_FAILURE"` LogoutRedirect string `envconfig:"LOGOUT_REDIRECT"` }
Config is configuration of google social login
Click to show internal directories.
Click to hide internal directories.