Documentation
¶
Index ¶
- Constants
- Variables
- func InsertGoogleData(ctx context.Context, db *pgxpool.Pool, claims claims, expiresAt time.Time) (token string, error error)
- func InsertUserData(ctx context.Context, db *pgxpool.Pool, signUp signUp, expiresAt time.Time) (token string, error error)
- func SignIn(ctx context.Context, db *pgxpool.Pool, signIn signIn, expiresAt time.Time) (token string, error error)
- type AuthHandler
- type GoogleCFG
- type User
Constants ¶
View Source
const UserIDKey contextKey = "userID"
Variables ¶
View Source
var ErrEmailExists = errors.New("email already exists")
View Source
var ErrInternalServerError = errors.New("internal server error")
View Source
var ErrInvalidEmailOrPassword = errors.New("invalid email or password")
Functions ¶
func InsertGoogleData ¶
func InsertUserData ¶
Types ¶
type AuthHandler ¶
func (*AuthHandler) GetSession ¶
func (Auth *AuthHandler) GetSession() http.HandlerFunc
func (*AuthHandler) Protected ¶
func (Auth *AuthHandler) Protected(next http.HandlerFunc) http.HandlerFunc
func (*AuthHandler) SignIn ¶
func (Auth *AuthHandler) SignIn() http.HandlerFunc
func (*AuthHandler) SignOut ¶
func (Auth *AuthHandler) SignOut() http.HandlerFunc
func (*AuthHandler) SignUp ¶
func (Auth *AuthHandler) SignUp() http.HandlerFunc
type GoogleCFG ¶
type GoogleCFG struct {
RedirectOrigin string
CookieDomain string
SecureCookie bool
Config oauth2.Config
IDTokenVerifier *oidc.IDTokenVerifier
DB *pgxpool.Pool
}
func GoogleConfig ¶
func (*GoogleCFG) GoogleCallback ¶
func (cfg *GoogleCFG) GoogleCallback() http.HandlerFunc
func (*GoogleCFG) GoogleSignIn ¶
func (cfg *GoogleCFG) GoogleSignIn() http.HandlerFunc
Click to show internal directories.
Click to hide internal directories.