oauth

package
v0.0.0-...-62869bb Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package oauth provides an HTTP handler to handle OAuth2 redirect and callback requests for the bebop web app.

Index

Constants

View Source
const (
	STATE_COOKIE  = "bebop_oauth_state"
	RESULT_COOKIE = "bebop_oauth_state"
)

Variables

This section is empty.

Functions

func SetResultCookie

func SetResultCookie(h *Handler, w http.ResponseWriter, res string, maxAge int)

func SetStateCookie

func SetStateCookie(h *Handler, w http.ResponseWriter, maxAge int) string

func ValidEmailReqest

func ValidEmailReqest(h *Handler, w http.ResponseWriter, r *http.Request, req *EmaiRequest) bool

Types

type Config

type Config struct {
	Logger     *log.Logger
	UserStore  store.UserStore
	JWTService jwt.Service
	MountURL   string
	CookiePath string
}

Config is a configuration of an OAuth handler.

type EmaiRequest

type EmaiRequest struct {
	Email    *string `json:"email"`
	Password *string `json:"password"`
}

Email request signin and signup structure

type Handler

type Handler struct {
	*Config
	// contains filtered or unexported fields
}

Handler handles oauth2 authentication requests.

func New

func New(config *Config) *Handler

New creates a new handler based on the given config.

func (*Handler) AddProvider

func (h *Handler) AddProvider(name, id, secret string) error

AddProvider adds a new provider to oauth handler.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Server requests

Jump to

Keyboard shortcuts

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