middleware

package
v0.0.0-...-0c576d6 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const LoginRedirectCookieName = "login_redirect"
View Source
const UserSessionCookieName = "phdo_session"

Variables

View Source
var ErrAuthHeaderInvalidFormat = errors.New("authorization header format is invalid")
View Source
var ErrNoAuthHeader = errors.New("authorization header missing")
View Source
var ErrTokenNotFound = errors.New("authorization token not found")
View Source
var UploadID key

Functions

func AddUploadIDContext

func AddUploadIDContext(next http.Handler) http.Handler

func InitStore

func InitStore(config appconfig.OauthConfig) error

func TracingMiddleware

func TracingMiddleware(next http.Handler) http.Handler

Types

type AuthMiddleware

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

func NewAuthMiddleware

func NewAuthMiddleware(ctx context.Context, config appconfig.OauthConfig) (*AuthMiddleware, error)

func (AuthMiddleware) Validator

func (a AuthMiddleware) Validator() oauth.Validator

func (AuthMiddleware) VerifyOAuthTokenMiddleware

func (a AuthMiddleware) VerifyOAuthTokenMiddleware(next http.Handler) http.Handler

func (AuthMiddleware) VerifyUserSession

func (a AuthMiddleware) VerifyUserSession(next http.Handler) http.Handler

type Claims

type Claims struct {
	Scopes string `json:"scope"`
}

type HTTPError

type HTTPError struct {
	Code int
	Msg  string
}

func NewHTTPError

func NewHTTPError(code int, msg string) *HTTPError

func (*HTTPError) Error

func (e *HTTPError) Error() string

type IntrospectionResponse

type IntrospectionResponse struct {
	Active bool   `json:"active"`
	Scope  string `json:"scope"`
}

type UserSession

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

func GetUserSession

func GetUserSession(r *http.Request) (*UserSession, error)

func (*UserSession) Data

func (s *UserSession) Data() UserSessionData

func (*UserSession) Delete

func (s *UserSession) Delete(r *http.Request, w http.ResponseWriter) error

func (*UserSession) SetRedirect

func (s *UserSession) SetRedirect(r *http.Request, w http.ResponseWriter, redirect string) error

func (*UserSession) SetToken

func (s *UserSession) SetToken(r *http.Request, w http.ResponseWriter, token string, expiry int) error

type UserSessionData

type UserSessionData struct {
	Token    string
	Redirect string
}

Jump to

Keyboard shortcuts

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