auth

package
v0.0.0-...-f8730ee Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const ModifyEntryScope = "modify:entry"
View Source
const ReadMemberScope = "read:member"
View Source
const WriteEmailScope = "write:email"
View Source
const WriteImageScope = "write:image"
View Source
const WriteMemberScope = "write:member"

Variables

This section is empty.

Functions

func GetEmailsFromProvider

func GetEmailsFromProvider(w http.ResponseWriter, r *http.Request, oh OAuth2Handler, bearer string) ([]string, error)

func GetUserInfoURL

func GetUserInfoURL(oh OAuth2Handler) (string, error)

func GetUserSession

func GetUserSession(auth AuthHandler) http.HandlerFunc

Types

type AuthHandler

type AuthHandler struct {
	Store *sessions.CookieStore
}

func New

func New() AuthHandler

func (AuthHandler) CheckScope

func (a AuthHandler) CheckScope(router http.HandlerFunc, scope string) http.HandlerFunc

func (AuthHandler) ScopeOk

func (auth AuthHandler) ScopeOk(w http.ResponseWriter, r *http.Request, scope string) bool

type GithubUserInfo

type GithubUserInfo struct {
	Email        string `json:"email"`
	PrimaryEmail bool   `json:"primary"`
	Verified     bool   `json:"verified"`
	Visibility   string `json:"visibility"`
}

type GoogleUserInfo

type GoogleUserInfo struct {
	Id            string `json:"id"`
	Email         string `json:"email"`
	VerifiedEmail bool   `json:"verified_email"`
	Picture       string `json:"picture"`
}

type OAuth2Handler

type OAuth2Handler struct {
	Provider     string
	ClientID     string
	ClientSecret string
	RedirectURL  string
	Scopes       []string
}

func (OAuth2Handler) Oauth2CallbackHandler

func (oh OAuth2Handler) Oauth2CallbackHandler(auth AuthHandler) http.HandlerFunc

func (OAuth2Handler) Oauth2RedirectHandler

func (oh OAuth2Handler) Oauth2RedirectHandler(auth AuthHandler) http.HandlerFunc

func (OAuth2Handler) VerifyEmail

func (oh OAuth2Handler) VerifyEmail(auth AuthHandler, db *sql.DB) http.HandlerFunc

type SessionInfo

type SessionInfo struct {
	Scopes     []string `json:"scopes"`
	UserName   string   `json:"username"`
	Email      string   `json:"email"`
	FulHaxPass string   `json:"fulHaxPass"`
}

Jump to

Keyboard shortcuts

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