mock

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockProvider

type MockProvider struct {
	// User es la identidad simulada que se devolverá en GetUserInfo.
	// Requerido: el consumidor debe fijarlo explícitamente.
	User auth.OAuthUserInfo
}

MockProvider simula Google OAuth sin red, manteniendo el mismo flujo y rutas que producción (/oauth/google → /oauth/callback/google). Es idéntico visualmente al login real (mismo botón, misma URL) pero sin secretos ni Google.

Toda la identidad (ID, Email, Name, Avatar) debe ser configurada por el consumidor (ej. misitio/config/auth_local.go). No hay valores harcodeados.

func (*MockProvider) AuthCodeURL

func (m *MockProvider) AuthCodeURL(state string) string

AuthCodeURL devuelve directamente la URL de callback con state y code mock. El navegador sigue el 302 de /oauth/google y cae inmediatamente en /oauth/callback/google?state=...&code=mockcode, sin salir a Google.

func (*MockProvider) ExchangeCode

func (m *MockProvider) ExchangeCode(code string) (auth.OAuthToken, error)

func (*MockProvider) GetUserInfo

func (m *MockProvider) GetUserInfo(token auth.OAuthToken) (auth.OAuthUserInfo, error)

func (*MockProvider) Name

func (m *MockProvider) Name() string

Jump to

Keyboard shortcuts

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