powa

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: MIT Imports: 18 Imported by: 0

README

powa

Point Of Workspace Authentication. In short, powa.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCookieStore

func NewCookieStore(key string) *sessions.CookieStore

func WriteHttpError

func WriteHttpError(w http.ResponseWriter, err error)

Types

type Authenticator

type Authenticator struct {
	// contains filtered or unexported fields
}

func NewAuthenticator

func NewAuthenticator(conf *oauth2.Config, provider OIDCProvider) *Authenticator

func (*Authenticator) StartAuthentication

func (a *Authenticator) StartAuthentication() (string, string, time.Time)

OpenID Connectを利用した認証の開始

func (*Authenticator) VerifyAuthentication

func (a *Authenticator) VerifyAuthentication(ctx context.Context, rawIDToken string) (*openIDToken, error)

OpenID Connectの認証結果の検証

type HttpError

type HttpError interface {
	Error() string
	StatusCode() int
	Detail() error
}

func NewHttpError

func NewHttpError(code int, message string, detail error) HttpError

type LoginSession

type LoginSession struct {
	Email      string
	Sub        string
	ValidUntil time.Time
}

func ExtractSession

func ExtractSession(req *http.Request, store *sessions.CookieStore) *LoginSession

type OIDCProvider

type OIDCProvider interface {
	Verifier(config *oidc.Config) *oidc.IDTokenVerifier
	Endpoint() oauth2.Endpoint
}

func NewGoogleAuthProvider

func NewGoogleAuthProvider(ctx context.Context) (OIDCProvider, error)

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(mountOn string, opts *ServerOptions) (*Server, error)

func (*Server) AuthorizeMiddleware

func (s *Server) AuthorizeMiddleware(next http.Handler) http.Handler

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ServerOptions

type ServerOptions struct {
	CookieStore    *sessions.CookieStore
	ClientID       string
	ClientSecret   string
	VirtualHost    string
	Title          string
	AllowedDomains []string
}

Jump to

Keyboard shortcuts

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