oidc

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionCookieName        = "dioad_session"
	PreAuthRefererCookieName = "auth_referer"
)

Variables

This section is empty.

Functions

func AccessTokenFromContext added in v0.52.0

func AccessTokenFromContext(ctx context.Context) string

func ContextWithAccessToken added in v0.52.0

func ContextWithAccessToken(ctx context.Context, token string) context.Context

func NewContextWithOIDCUserInfo

func NewContextWithOIDCUserInfo(ctx context.Context, userInfo *goth.User) context.Context

func OIDCUserInfoFromContext

func OIDCUserInfoFromContext(ctx context.Context) *goth.User

Types

type Config

type Config struct {
	ProviderMap  ProviderMap       `mapstructure:"providers"`
	CookieConfig http.CookieConfig `mapstructure:"cookies"`
}

type Handler

type Handler struct {
	CookieStore             sessions.Store
	LoginPath               string
	LogoutPath              string
	CallbackDefaultRedirect string
	HomePath                string
}

func NewHandler

func NewHandler(config Config, store sessions.Store) *Handler

func (*Handler) AuthRequest added in v0.37.0

func (h *Handler) AuthRequest(r *http.Request) (stdctx.Context, error)

func (*Handler) AuthStart

func (h *Handler) AuthStart() http.HandlerFunc

func (*Handler) AuthWrapper

func (h *Handler) AuthWrapper(next http.HandlerFunc) http.HandlerFunc

func (*Handler) Callback

func (h *Handler) Callback() http.HandlerFunc

func (*Handler) LogoutHandler

func (h *Handler) LogoutHandler() http.HandlerFunc

func (*Handler) Middleware added in v0.38.1

func (h *Handler) Middleware(next http.Handler) http.Handler

type ProviderConfig

type ProviderConfig struct {
	ClientID     string   `mapstructure:"client-id"`
	ClientSecret string   `mapstructure:"client-secret"`
	Callback     string   `mapstructure:"callback"`
	Scopes       []string `mapstructure:"scopes"`        // OAuth2 Scopes - Optional
	DiscoveryURL string   `mapstructure:"discovery-url"` // OpenID Connect Discovery URL - Optional
}

type ProviderMap

type ProviderMap map[string]ProviderConfig

type SessionData

type SessionData struct {
	ID        uuid.UUID
	Principal string
	Provider  string
	User      goth.User
}

Jump to

Keyboard shortcuts

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