oauthprovider

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package oauthprovider provides OAuth2/OIDC authentication with support for Google, GitHub, and Okta as identity providers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() plugin.Plugin

New creates a new Plugin instance.

Types

type Plugin

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

Plugin implements OAuth2/OIDC authentication with Google, GitHub, and Okta.

func (*Plugin) Info

func (p *Plugin) Info() plugin.PluginInfo

Info returns plugin metadata for discovery and documentation.

func (*Plugin) Init

func (p *Plugin) Init(ctx context.Context, env *plugin.Environment) error

Init initializes the plugin with the given environment. No config is parsed since OAuth provider settings are stored in the oauth_config table.

func (*Plugin) Middleware

func (p *Plugin) Middleware(next http.Handler) http.Handler

Middleware validates the OAuth session token from the Authorization header and injects session info into the request context. It skips /oauth/ and /healthz paths.

func (*Plugin) Migrations

func (p *Plugin) Migrations() []plugin.Migration

Migrations returns the database schema for OAuth configuration and sessions. Tables are idempotent (IF NOT EXISTS) and safe to run multiple times.

func (*Plugin) RegisterRoutes

func (p *Plugin) RegisterRoutes(mux *http.ServeMux) error

RegisterRoutes registers HTTP handlers for the OAuth flow and session management.

type SessionInfo

type SessionInfo struct {
	TenantID  uuid.UUID
	SessionID uuid.UUID
	UserEmail string
}

SessionInfo holds user identity extracted from an OAuth session.

func SessionFromContext

func SessionFromContext(ctx context.Context) (*SessionInfo, bool)

SessionFromContext extracts the OAuth session info from the request context.

Jump to

Keyboard shortcuts

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