webapp

package
v0.0.0-...-10e5b55 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: Apache-2.0 Imports: 79 Imported by: 0

Documentation

Index

Constants

View Source
const LoginLinkOTPPageQueryStateKey = "state"
View Source
const (
	// WebsocketMessageKindRefresh means when the client receives this message, they should refresh the page.
	WebsocketMessageKindRefresh = "refresh"
)
View Source
const WechatActionCallback = "callback"

Variables

View Source
var AuthEntryPointMiddlewareLogger = slogutil.NewLogger("auth_entry_point_middleware")
View Source
var AuthflowBotProtectionSchema = validation.NewSimpleSchema(`
	{
		"type": "object",
		"properties": {
			"x_bot_protection_provider_type": { "type": "string" },
			"x_bot_protection_provider_response": { "type": "string" }
		},
		"required": ["x_bot_protection_provider_type", "x_bot_protection_provider_response"]
	}
`)
View Source
var AuthflowControllerLogger = slogutil.NewLogger("authflow_controller")
View Source
var CSRFMiddlewareLogger = slogutil.NewLogger("webapp-csrf-middleware")
View Source
var Components = web.ComponentsHTML
View Source
var DirectAccessDisableComponents = web.DirectAccessDisableComponentsHTML
View Source
var ErrNoFallbackAvailable = fmt.Errorf("webapp: no fallback is available")
View Source
var ErrorRendererLogger = slogutil.NewLogger("error_renderer")
View Source
var FeatureDisabledHandlerLogger = slogutil.NewLogger("feature_disabled_handler")
View Source
var PanicMiddlewareLogger = slogutil.NewLogger("webapp-panic-middleware")
View Source
var SettingsComponents = web.SettingsComponentsHTML
View Source
var TemplateCSRFErrorHTML = template.RegisterHTML(
	"web/authflowv2/csrf_error_page.html",
	Components...,
)
View Source
var TemplateCSRFErrorInstructionHTML = template.RegisterHTML(
	"web/authflowv2/csrf_error_instruction.html",
	Components...,
)
View Source
var TemplateDirectAccessDisable = template.RegisterHTML(
	"web/authflowv2/direct_access_disabled.html",
	DirectAccessDisableComponents...,
)
View Source
var TemplateTurboErrorHTML = template.RegisterHTML(
	"web/turbo_error.html",
	Components...,
)
View Source
var TemplateV2WebFatalErrorHTML = template.RegisterHTML(
	"web/authflowv2/fatal_error.html",
	Components...,
)

NOTE: To resolve import cycle in panic_middleware.go, put it here as workaround

View Source
var TemplateWebAuthflowSSOCallbackHTML = template.RegisterHTML(
	"web/authflowv2/sso_callback.html",
	Components...,
)
View Source
var TemplateWebConsentHTML = template.RegisterHTML(
	"web/authflowv2/consent.html",
	Components...,
)
View Source
var TemplateWebDownloadRecoveryCodeTXT = template.RegisterPlainText(
	"web/download_recovery_code.txt",
	plainTextComponents...,
)
View Source
var TemplateWebFeatureDisabledHTML = template.RegisterHTML(
	"web/authflowv2/error_feature_disabled.html",
	Components...,
)
View Source
var TemplateWebLogoutHTML = template.RegisterHTML(
	"web/authflowv2/logout.html",
	Components...,
)
View Source
var TemplateWebReturnHTML = template.RegisterHTML(
	"web/authflowv2/return.html",
	Components...,
)
View Source
var TemplateWebRobotsTXT = template.RegisterPlainText(
	"web/robots.txt",
	plainTextComponents...,
)
View Source
var TemplateWebTesterHTML = template.RegisterHTML(
	"web/authflowv2/tester.html",
	Components...,
)
View Source
var TesterScopes = []string{
	"openid", oauth.OfflineAccess, oauth.FullAccessScope,
}

Functions

func ConfigureAppStaticAssetsRoute

func ConfigureAppStaticAssetsRoute(route httproute.Route) httproute.Route

func ConfigureCSRFErrorInstructionRoute

func ConfigureCSRFErrorInstructionRoute(route httproute.Route) httproute.Route

func ConfigureFeatureDisabledRoute

func ConfigureFeatureDisabledRoute(route httproute.Route) httproute.Route

func ConfigureGeneratedStaticAssetsRoute

func ConfigureGeneratedStaticAssetsRoute(route httproute.Route) httproute.Route

func ConfigureLogoutRoute

func ConfigureLogoutRoute(route httproute.Route) httproute.Route

func ConfigureNoProjectSSOCallbackRoute

func ConfigureNoProjectSSOCallbackRoute(route httproute.Route) httproute.Route

func ConfigureOAuthEntrypointRoute

func ConfigureOAuthEntrypointRoute(route httproute.Route) httproute.Route

func ConfigurePasskeyCreationOptionsRoute

func ConfigurePasskeyCreationOptionsRoute(route httproute.Route) httproute.Route

func ConfigurePasskeyRequestOptionsRoute

func ConfigurePasskeyRequestOptionsRoute(route httproute.Route) httproute.Route

func ConfigureReturnRoute

func ConfigureReturnRoute(route httproute.Route) httproute.Route

func ConfigureRobotsTXTRoute

func ConfigureRobotsTXTRoute(route httproute.Route) httproute.Route

func ConfigureRootRoute

func ConfigureRootRoute(route httproute.Route) httproute.Route

func ConfigureSSOCallbackRoute

func ConfigureSSOCallbackRoute(route httproute.Route) httproute.Route

func ConfigureTesterRoute

func ConfigureTesterRoute(route httproute.Route) httproute.Route

func ConfigureWebsocketRoute

func ConfigureWebsocketRoute(route httproute.Route) httproute.Route

func ConfigureWechatCallbackRoute

func ConfigureWechatCallbackRoute(route httproute.Route) httproute.Route

func ConfigureWhatsappCloudAPIWebhookRoute

func ConfigureWhatsappCloudAPIWebhookRoute(route httproute.Route) httproute.Route

func CreateQRCodeImage

func CreateQRCodeImage(content string, width int, height int, level qr.ErrorCorrectionLevel) (image.Image, error)

func DeriveFlowName

func DeriveFlowName(flowType authflow.FlowType, flowGroup string, clientAllowlist *config.AuthenticationFlowAllowlist, definedGroups []*config.UIAuthenticationFlowGroup) (string, error)

func FindLoginIDInPreviousInput

func FindLoginIDInPreviousInput(s *webapp.Session, xStep string) (string, bool)

func FormToJSON

func FormToJSON(form url.Values) map[string]interface{}

func FormatRecoveryCodes

func FormatRecoveryCodes(recoveryCodes []string) []string

func GetSettingsUIImplementation

func GetSettingsUIImplementation(ctx context.Context) config.SettingsUIImplementation

func GetUIImplementation

func GetUIImplementation(ctx context.Context) config.UIImplementation

func GetXStepFromQuery

func GetXStepFromQuery(r *http.Request) string

func HandleAccountRecoveryIdentificationBotProtection

func HandleAccountRecoveryIdentificationBotProtection(ctx context.Context, identification config.AuthenticationFlowAccountRecoveryIdentification, flowResp *authflow.FlowResponse, formData url.Values, input map[string]interface{}) (err error)

As IntentAccountRecoveryFlowStepIdentify has it's own IdentificationData type to narrow down Identification as {"email", "phone"}, we imitate the same logic in HandleIdentificationBotProtection here for account recovery

func HandleAuthenticationBotProtection

func HandleAuthenticationBotProtection(ctx context.Context, authentication model.AuthenticationFlowAuthentication, flowResp *authflow.FlowResponse, formData url.Values, input map[string]interface{}) (err error)

func HandleCreateAuthenticatorBotProtection

func HandleCreateAuthenticatorBotProtection(ctx context.Context, authentication model.AuthenticationFlowAuthentication, flowResp *authflow.FlowResponse, formData url.Values, input map[string]interface{}) (err error)

func HandleIdentificationBotProtection

func HandleIdentificationBotProtection(ctx context.Context, identification model.AuthenticationFlowIdentification, flowResp *authflow.FlowResponse, formData url.Values, input map[string]interface{}) (err error)

func IdentitiesDisplayName

func IdentitiesDisplayName(identities []*identity.Info) string

func InsertBotProtection

func InsertBotProtection(formData url.Values, input map[string]interface{})

func IsBotProtectionInputValid

func IsBotProtectionInputValid(ctx context.Context, formData url.Values) bool

func JSONPointerFormToMap

func JSONPointerFormToMap(form url.Values) map[string]string

func SetRecoveryCodeAttachmentHeaders

func SetRecoveryCodeAttachmentHeaders(w http.ResponseWriter)

func ValidateBotProtectionInput

func ValidateBotProtectionInput(ctx context.Context, formData url.Values) error

func WebsocketChannelName

func WebsocketChannelName(appID string, id string) string

func WithSettingsUIImplementation

func WithSettingsUIImplementation(ctx context.Context, impl config.SettingsUIImplementation) context.Context

func WithUIImplementation

func WithUIImplementation(ctx context.Context, impl config.UIImplementation) context.Context

Types

type AdvanceOptions

type AdvanceOptions struct {
	// Treat the next screen as the extend of the taken branch
	// Allowing alternative branches to be selected based on the current state
	InheritTakenBranchState bool
}

type AppStaticAssetsHandler

type AppStaticAssetsHandler struct {
	Resources ResourceManager
}

func (*AppStaticAssetsHandler) ServeHTTP

type AuthEntryPointMiddleware

type AuthEntryPointMiddleware struct {
	BaseViewModel       *viewmodels.BaseViewModeler
	Renderer            Renderer
	AppHostSuffixes     config.AppHostSuffixes
	TrustProxy          config.TrustProxy
	OAuthConfig         *config.OAuthConfig
	UIConfig            *config.UIConfig
	OAuthClientResolver WebappOAuthClientResolver
}

func (*AuthEntryPointMiddleware) Handle

type AuthflowController

type AuthflowController struct {
	TesterEndpointsProvider tester.EndpointsProvider
	TrustProxy              config.TrustProxy
	Clock                   clock.Clock

	Cookies        AuthflowControllerCookieManager
	Sessions       AuthflowControllerSessionStore
	SessionCookie  webapp.SessionCookieDef
	SignedUpCookie webapp.SignedUpCookieDef
	Endpoints      AuthflowEndpoints

	Authflows AuthflowControllerAuthflowService

	OAuthSessions  AuthflowControllerOAuthSessionService
	SAMLSessions   AuthflowControllerSAMLSessionService
	UIInfoResolver AuthflowControllerUIInfoResolver

	UIConfig            *config.UIConfig
	OAuthClientResolver AuthflowControllerOAuthClientResolver

	Navigator     AuthflowNavigator
	ErrorRenderer *ErrorRenderer
}

func (*AuthflowController) AdvanceDirectly

func (c *AuthflowController) AdvanceDirectly(
	route string,
	screen *webapp.AuthflowScreenWithFlowResponse,
	query url.Values,
) *webapp.Result

func (*AuthflowController) AdvanceToDelayedScreen

func (c *AuthflowController) AdvanceToDelayedScreen(r *http.Request, s *webapp.Session) (*webapp.Result, error)

func (*AuthflowController) AdvanceWithInput

func (c *AuthflowController) AdvanceWithInput(
	ctx context.Context,
	r *http.Request,
	s *webapp.Session,
	screen0 *webapp.AuthflowScreenWithFlowResponse,
	input map[string]interface{},
	options *AdvanceOptions,
) (result *webapp.Result, err error)

AdvanceWithInput is same as AdvanceWithInputs but only allow one input.

func (*AuthflowController) AdvanceWithInputs

func (c *AuthflowController) AdvanceWithInputs(
	ctx context.Context,
	r *http.Request,
	s *webapp.Session,
	screen0 *webapp.AuthflowScreenWithFlowResponse,
	inputs []map[string]interface{},
	options *AdvanceOptions,
) (*webapp.Result, error)

AdvanceWithInputs is for feeding multiple inputs that would advance the flow.

func (*AuthflowController) DelayScreen

func (c *AuthflowController) DelayScreen(ctx context.Context, r *http.Request,
	s *webapp.Session,
	sourceScreen *webapp.AuthflowScreen,
	targetResult *webapp.Result,
	screenFactory func(*webapp.AuthflowScreen) *webapp.AuthflowScreen,
) (*webapp.AuthflowScreen, error)

func (*AuthflowController) FeedInputWithoutNavigate

func (c *AuthflowController) FeedInputWithoutNavigate(ctx context.Context, stateToken string, input interface{}) (*authflow.ServiceOutput, error)

func (*AuthflowController) Finish

func (*AuthflowController) GetAccountLinkingSSOCallbackURL

func (c *AuthflowController) GetAccountLinkingSSOCallbackURL(alias string, data declarative.AccountLinkingIdentifyData) (string, error)

func (*AuthflowController) GetScreen

func (*AuthflowController) HandleOAuthCallback

func (c *AuthflowController) HandleOAuthCallback(ctx context.Context, w http.ResponseWriter, r *http.Request, callbackResponse AuthflowOAuthCallbackResponse)

func (*AuthflowController) HandleResumeOfFlow

func (c *AuthflowController) HandleResumeOfFlow(
	ctx context.Context,
	w http.ResponseWriter,
	r *http.Request,
	opts webapp.SessionOptions,
	handlers *AuthflowControllerHandlers,
	input map[string]interface{},
	errorHandler *AuthflowControllerErrorHandler,
)

func (*AuthflowController) HandleStartOfFlow

func (c *AuthflowController) HandleStartOfFlow(
	ctx context.Context,
	w http.ResponseWriter,
	r *http.Request,
	opts webapp.SessionOptions,
	flowType authflow.FlowType,
	handlers *AuthflowControllerHandlers,
	input interface{})

func (*AuthflowController) HandleStep

func (*AuthflowController) HandleWithoutScreen

func (c *AuthflowController) HandleWithoutScreen(ctx context.Context, w http.ResponseWriter, r *http.Request, handlers *AuthflowControllerHandlers)

func (*AuthflowController) HandleWithoutSession

func (c *AuthflowController) HandleWithoutSession(ctx context.Context, w http.ResponseWriter, r *http.Request, handlers *AuthflowControllerHandlers)

func (*AuthflowController) RedirectURI

func (c *AuthflowController) RedirectURI(r *http.Request) string

func (*AuthflowController) ReplaceScreen

func (c *AuthflowController) ReplaceScreen(ctx context.Context, r *http.Request, s *webapp.Session, flowType authflow.FlowType, input map[string]interface{}) (result *webapp.Result, err error)

ReplaceScreen is for switching flow.

func (*AuthflowController) Restart

func (c *AuthflowController) Restart(ctx context.Context, s *webapp.Session) (result *webapp.Result, err error)

func (*AuthflowController) UpdateWithInput

func (c *AuthflowController) UpdateWithInput(ctx context.Context, r *http.Request, s *webapp.Session, screen *webapp.AuthflowScreenWithFlowResponse, input map[string]interface{}) (result *webapp.Result, err error)

UpdateWithInput is for feeding an input that would just update the current node. One application is resend.

func (*AuthflowController) UseOAuthIdentification

func (c *AuthflowController) UseOAuthIdentification(
	ctx context.Context, s *webapp.Session,
	w http.ResponseWriter, r *http.Request,
	screen *webapp.AuthflowScreen,
	alias string, identificationOptions []declarative.IdentificationOption,
	flowExecutor func(input map[string]interface{},
	) (
		result *webapp.Result,
		err error),
) (*webapp.Result, error)

type AuthflowControllerAuthflowService

type AuthflowControllerAuthflowService interface {
	CreateNewFlow(ctx context.Context, intent authflow.PublicFlow, sessionOptions *authflow.SessionOptions) (*authflow.ServiceOutput, error)
	Get(ctx context.Context, stateToken string) (*authflow.ServiceOutput, error)
	FeedInput(ctx context.Context, stateToken string, rawMessage json.RawMessage) (*authflow.ServiceOutput, error)
}

type AuthflowControllerCookieManager

type AuthflowControllerCookieManager interface {
	GetCookie(r *http.Request, def *httputil.CookieDef) (*http.Cookie, error)
	ValueCookie(def *httputil.CookieDef, value string) *http.Cookie
	ClearCookie(def *httputil.CookieDef) *http.Cookie
}

type AuthflowControllerErrorHandler

type AuthflowControllerErrorHandler func(ctx context.Context, w http.ResponseWriter, r *http.Request, err error) error

type AuthflowControllerHandler

type AuthflowControllerHandler func(ctx context.Context, s *webapp.Session, screen *webapp.AuthflowScreenWithFlowResponse) error

type AuthflowControllerHandlers

type AuthflowControllerHandlers struct {
	GetHandler           AuthflowControllerHandler
	PostHandlers         map[string]AuthflowControllerHandler
	InlinePreviewHandler AuthflowControllerInlinePreviewHandler
}

func (*AuthflowControllerHandlers) Get

func (*AuthflowControllerHandlers) InlinePreview

func (*AuthflowControllerHandlers) PostAction

type AuthflowControllerInlinePreviewHandler

type AuthflowControllerInlinePreviewHandler func(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type AuthflowControllerOAuthClientResolver

type AuthflowControllerOAuthClientResolver interface {
	ResolveClient(clientID string) *config.OAuthClientConfig
}

type AuthflowControllerOAuthSessionService

type AuthflowControllerOAuthSessionService interface {
	Get(ctx context.Context, entryID string) (*oauthsession.Entry, error)
}

type AuthflowControllerSAMLSessionService

type AuthflowControllerSAMLSessionService interface {
	Get(ctx context.Context, entryID string) (*samlsession.SAMLSession, error)
}

type AuthflowControllerSessionStore

type AuthflowControllerSessionStore interface {
	Get(ctx context.Context, id string) (*webapp.Session, error)
	Create(ctx context.Context, session *webapp.Session) (err error)
	Update(ctx context.Context, session *webapp.Session) (err error)
	Delete(ctx context.Context, id string) (err error)
}

type AuthflowControllerUIInfoResolver

type AuthflowControllerUIInfoResolver interface {
	ResolveForUI(ctx context.Context, r protocol.AuthorizationRequest) (*oidc.UIInfo, error)
	LooksLikeOriginallyTriggeredByOIDCOrSaml(r *http.Request) bool
}

type AuthflowEndpoints

type AuthflowEndpoints interface {
	SSOCallbackURL(alias string) *url.URL
	SharedSSOCallbackURL() *url.URL
}

type AuthflowNavigator

type AuthflowNavigator interface {
	Navigate(ctx context.Context, screen *webapp.AuthflowScreenWithFlowResponse, r *http.Request, webSessionID string, result *webapp.Result)
	NavigateSelectAccount(result *webapp.Result)
	NavigateResetPasswordSuccessPage() string
	NavigateVerifyBotProtection(result *webapp.Result)
	NavigateOAuthProviderDemoCredentialPage(screen *webapp.AuthflowScreen, r *http.Request) *webapp.Result
}

type AuthflowOAuthCallbackResponse

type AuthflowOAuthCallbackResponse struct {
	Query string
	State *webappoauth.WebappOAuthState
}

type CSRFErrorInstructionHandler

type CSRFErrorInstructionHandler struct {
	Controller    *AuthflowController
	BaseViewModel *viewmodels.BaseViewModeler
	Renderer      Renderer
}

func (*CSRFErrorInstructionHandler) GetData

func (h *CSRFErrorInstructionHandler) GetData(w http.ResponseWriter, r *http.Request) (map[string]interface{}, error)

func (*CSRFErrorInstructionHandler) ServeHTTP

type CSRFMiddleware

type CSRFMiddleware struct {
	TrustProxy              config.TrustProxy
	BaseViewModel           *viewmodels.BaseViewModeler
	Renderer                Renderer
	UIImplementationService CSRFMiddlewareUIImplementationService
	EnvironmentConfig       *config.EnvironmentConfig
}

func (*CSRFMiddleware) Handle

func (m *CSRFMiddleware) Handle(next http.Handler) http.Handler

type CSRFMiddlewareUIImplementationService

type CSRFMiddlewareUIImplementationService interface {
	GetUIImplementation() config.UIImplementation
}

type Controller

type Controller struct {
	ControllerDeps
	// contains filtered or unexported fields
}

func (*Controller) BeforeHandle

func (c *Controller) BeforeHandle(fn func(ctx context.Context) error)

func (*Controller) CreateSettingsActionResult

func (c *Controller) CreateSettingsActionResult(ctx context.Context, webSession *webapp.Session) (*webapp.SettingsCompletedResult, bool, error)

func (*Controller) DeleteSession

func (c *Controller) DeleteSession(ctx context.Context, id string) error

func (*Controller) EntryPointGet

func (c *Controller) EntryPointGet(
	ctx context.Context,
	opts webapp.SessionOptions,
	intent interaction.Intent,
) (*interaction.Graph, error)

func (*Controller) EntryPointPost

func (c *Controller) EntryPointPost(
	ctx context.Context,
	opts webapp.SessionOptions,
	intent interaction.Intent,
	inputFn func() (interface{}, error),
) (*webapp.Result, error)

func (*Controller) EntryPointSession

func (c *Controller) EntryPointSession(ctx context.Context, opts webapp.SessionOptions) *webapp.Session

func (*Controller) FinishSettingsAction

func (c *Controller) FinishSettingsAction(ctx context.Context, userSession session.ResolvedSession, webSession *webapp.Session) error

func (*Controller) FinishSettingsActionWithResult

func (c *Controller) FinishSettingsActionWithResult(ctx context.Context, userSession session.ResolvedSession, webSession *webapp.Session) (*webapp.SettingsCompletedResult, error)

func (*Controller) Get

func (c *Controller) Get(fn func(ctx context.Context) error)

func (*Controller) GetSession

func (c *Controller) GetSession(ctx context.Context, id string) (*webapp.Session, error)

func (*Controller) GetWithSettingsActionWebSession

func (c *Controller) GetWithSettingsActionWebSession(r *http.Request, fn func(context.Context, *webapp.Session) error)

func (*Controller) InteractionGet

func (c *Controller) InteractionGet(ctx context.Context) (*interaction.Graph, error)

func (*Controller) InteractionGetWithSession

func (c *Controller) InteractionGetWithSession(ctx context.Context, s *webapp.Session) (*interaction.Graph, error)

func (*Controller) InteractionOAuthCallback

func (c *Controller) InteractionOAuthCallback(ctx context.Context, oauthInput InputOAuthCallback, oauthState *webappoauth.WebappOAuthState) (*webapp.Result, error)

func (*Controller) InteractionPost

func (c *Controller) InteractionPost(ctx context.Context, inputFn func() (interface{}, error)) (*webapp.Result, error)

func (*Controller) InteractionSession

func (c *Controller) InteractionSession(ctx context.Context) (*webapp.Session, error)

func (*Controller) IsInSettingsAction

func (c *Controller) IsInSettingsAction(userSession session.ResolvedSession, webSession *webapp.Session) bool

func (*Controller) PostAction

func (c *Controller) PostAction(action string, fn func(ctx context.Context) error)

func (*Controller) PostActionWithSettingsActionWebSession

func (c *Controller) PostActionWithSettingsActionWebSession(action string, r *http.Request, fn func(context.Context, *webapp.Session) error)

func (*Controller) RedirectURI

func (c *Controller) RedirectURI() string

func (*Controller) RequireUserID

func (c *Controller) RequireUserID(ctx context.Context) string

func (*Controller) ServeWithDBTx

func (c *Controller) ServeWithDBTx(ctx context.Context)

func (*Controller) ServeWithoutDBTx

func (c *Controller) ServeWithoutDBTx(ctx context.Context)

func (*Controller) UpdateSession

func (c *Controller) UpdateSession(ctx context.Context, s *webapp.Session) error

type ControllerAuthenticationInfoService

type ControllerAuthenticationInfoService interface {
	Get(ctx context.Context, entryID string) (entry *authenticationinfo.Entry, err error)
	Save(ctx context.Context, entry *authenticationinfo.Entry) (err error)
}

type ControllerDeps

type ControllerDeps struct {
	Database                  *appdb.Handle
	RedisHandle               *appredis.Handle
	AppID                     config.AppID
	Page                      PageService
	BaseViewModel             *viewmodels.BaseViewModeler
	Renderer                  Renderer
	Publisher                 *Publisher
	Clock                     clock.Clock
	TesterEndpointsProvider   tester.EndpointsProvider
	ErrorRenderer             *ErrorRenderer
	UIInfoResolver            ControllerUIInfoResolver
	AuthenticationInfoService ControllerAuthenticationInfoService
	Sessions                  ControllerSessionStore
	OAuthSessions             ControllerOAuthSessionService

	TrustProxy config.TrustProxy
}

type ControllerFactory

type ControllerFactory struct {
	ControllerDeps
}

func (*ControllerFactory) New

type ControllerOAuthSessionService

type ControllerOAuthSessionService interface {
	Get(ctx context.Context, entryID string) (*oauthsession.Entry, error)
	Save(ctx context.Context, entry *oauthsession.Entry) error
}

type ControllerSessionStore

type ControllerSessionStore interface {
	Get(ctx context.Context, id string) (*webapp.Session, error)
	Create(ctx context.Context, session *webapp.Session) (err error)
	Update(ctx context.Context, session *webapp.Session) (err error)
	Delete(ctx context.Context, id string) (err error)
}

type ControllerUIInfoResolver

type ControllerUIInfoResolver interface {
	SetAuthenticationInfoInQuery(redirectURI string, e *authenticationinfo.Entry) string
}

type CookieManager

type CookieManager interface {
	GetCookie(r *http.Request, def *httputil.CookieDef) (*http.Cookie, error)
	ValueCookie(def *httputil.CookieDef, value string) *http.Cookie
	ClearCookie(def *httputil.CookieDef) *http.Cookie
}

type ErrorRenderer

type ErrorRenderer struct {
	ErrorService            *webapp.ErrorService
	UIImplementationService ErrorRendererUIImplementationService
	Renderer                Renderer
	BaseViewModel           *viewmodels.BaseViewModeler

	AuthflowV2Navigator ErrorRendererAuthflowV2Navigator
}

func (*ErrorRenderer) GetErrorData

func (h *ErrorRenderer) GetErrorData(ctx context.Context, r *http.Request, w http.ResponseWriter, err error) (map[string]interface{}, error)

func (*ErrorRenderer) MakeAuthflowErrorResult

func (s *ErrorRenderer) MakeAuthflowErrorResult(ctx context.Context, w http.ResponseWriter, r *http.Request, u url.URL, err error) httputil.Result

func (*ErrorRenderer) RenderError

func (s *ErrorRenderer) RenderError(ctx context.Context, w http.ResponseWriter, r *http.Request, err error)

type ErrorRendererAuthflowV2Navigator

type ErrorRendererAuthflowV2Navigator interface {
	NavigateNonRecoverableError(r *http.Request, u *url.URL, e error)
}

type ErrorRendererUIImplementationService

type ErrorRendererUIImplementationService interface {
	GetUIImplementation() config.UIImplementation
}

type FeatureDisabledHandler

type FeatureDisabledHandler struct {
	ControllerFactory ControllerFactory
	BaseViewModel     *viewmodels.BaseViewModeler
	Renderer          Renderer
}

func (*FeatureDisabledHandler) GetData

func (h *FeatureDisabledHandler) GetData(r *http.Request, rw http.ResponseWriter) (map[string]interface{}, error)

func (*FeatureDisabledHandler) ServeHTTP

type FormPrefiller

type FormPrefiller struct {
	LoginID *config.LoginIDConfig
	UI      *config.UIConfig
}

func (*FormPrefiller) Prefill

func (p *FormPrefiller) Prefill(form url.Values)

type GeneratedStaticAssetsHandler

type GeneratedStaticAssetsHandler struct {
	EmbeddedResources GlobalEmbeddedResourceManager
}

func (*GeneratedStaticAssetsHandler) ServeHTTP

type GlobalEmbeddedResourceManager

type GlobalEmbeddedResourceManager interface {
	Open(name string) (http.File, error)
}

type GlobalSessionService

type GlobalSessionService struct {
	SessionStore SessionStore
	Publisher    *Publisher
	Clock        clock.Clock
}

func (*GlobalSessionService) GetSession

func (s *GlobalSessionService) GetSession(ctx context.Context, sessionID string) (session *webapp.Session, err error)

func (*GlobalSessionService) UpdateSession

func (s *GlobalSessionService) UpdateSession(ctx context.Context, session *webapp.Session) error

type GlobalSessionServiceFactory

type GlobalSessionServiceFactory struct {
	Clock       clock.Clock
	RedisHandle *appredis.Handle
}

func (*GlobalSessionServiceFactory) NewGlobalSessionService

func (f *GlobalSessionServiceFactory) NewGlobalSessionService(appID config.AppID) *GlobalSessionService

type HTMLResult

type HTMLResult struct {
	Renderer Renderer
	Template *template.HTML
	Data     interface{}
}

func (*HTMLResult) IsInternalError

func (re *HTMLResult) IsInternalError() bool

func (*HTMLResult) WriteResponse

func (re *HTMLResult) WriteResponse(rw http.ResponseWriter, r *http.Request)

type ImplementationSwitcherHandler

type ImplementationSwitcherHandler struct {
	AuthflowV2 http.Handler
}

func (*ImplementationSwitcherHandler) ServeHTTP

type ImplementationSwitcherMiddleware

type ImplementationSwitcherMiddleware struct {
	UIImplementationService ImplementationSwitcherMiddlewareUIImplementationService
}

func (*ImplementationSwitcherMiddleware) Handle

type ImplementationSwitcherMiddlewareUIImplementationService

type ImplementationSwitcherMiddlewareUIImplementationService interface {
	GetUIImplementation() config.UIImplementation
}

type InputAuthOOB

type InputAuthOOB struct {
	Code        string
	DeviceToken bool
}

func (*InputAuthOOB) CreateDeviceToken

func (i *InputAuthOOB) CreateDeviceToken() bool

func (*InputAuthOOB) GetOOBOTP

func (i *InputAuthOOB) GetOOBOTP() string

type InputAuthPassword

type InputAuthPassword struct {
	Stage       string
	Password    string
	DeviceToken bool
}

func (*InputAuthPassword) CreateDeviceToken

func (i *InputAuthPassword) CreateDeviceToken() bool

func (*InputAuthPassword) GetAuthenticationStage

func (i *InputAuthPassword) GetAuthenticationStage() authn.AuthenticationStage

func (*InputAuthPassword) GetPassword

func (i *InputAuthPassword) GetPassword() string

type InputAuthRecoveryCode

type InputAuthRecoveryCode struct {
	Code        string
	DeviceToken bool
}

func (*InputAuthRecoveryCode) CreateDeviceToken

func (i *InputAuthRecoveryCode) CreateDeviceToken() bool

func (*InputAuthRecoveryCode) GetRecoveryCode

func (i *InputAuthRecoveryCode) GetRecoveryCode() string

type InputAuthTOTP

type InputAuthTOTP struct {
	Code        string
	DeviceToken bool
}

func (*InputAuthTOTP) CreateDeviceToken

func (i *InputAuthTOTP) CreateDeviceToken() bool

func (*InputAuthTOTP) GetTOTP

func (i *InputAuthTOTP) GetTOTP() string

type InputChangePassword

type InputChangePassword struct {
	AuthenticationStage authn.AuthenticationStage
	OldPassword         string
	NewPassword         string
}

func (*InputChangePassword) GetAuthenticationStage

func (i *InputChangePassword) GetAuthenticationStage() authn.AuthenticationStage

func (*InputChangePassword) GetNewPassword

func (i *InputChangePassword) GetNewPassword() string

func (*InputChangePassword) GetOldPassword

func (i *InputChangePassword) GetOldPassword() string

type InputConfirmTerminateOtherSessions

type InputConfirmTerminateOtherSessions struct {
	IsConfirm bool
}

func (*InputConfirmTerminateOtherSessions) GetIsConfirmed

func (i *InputConfirmTerminateOtherSessions) GetIsConfirmed() bool

type InputConfirmWeb3AccountRequest

type InputConfirmWeb3AccountRequest struct {
	Message   string
	Signature string
}

func (*InputConfirmWeb3AccountRequest) GetMessage

func (i *InputConfirmWeb3AccountRequest) GetMessage() string

func (*InputConfirmWeb3AccountRequest) GetSignature

func (i *InputConfirmWeb3AccountRequest) GetSignature() string

type InputCreateAuthenticator

type InputCreateAuthenticator struct{}

func (*InputCreateAuthenticator) RequestedByUser

func (i *InputCreateAuthenticator) RequestedByUser() bool

type InputNewLoginID

type InputNewLoginID struct {
	LoginIDType  string
	LoginIDKey   string
	LoginIDValue string
}

func (*InputNewLoginID) GetLoginID

func (i *InputNewLoginID) GetLoginID() string

func (*InputNewLoginID) GetLoginIDKey

func (i *InputNewLoginID) GetLoginIDKey() string

type InputOAuthCallback

type InputOAuthCallback struct {
	ProviderAlias string
	Query         string
}

func (*InputOAuthCallback) GetProviderAlias

func (i *InputOAuthCallback) GetProviderAlias() string

func (*InputOAuthCallback) GetQuery

func (i *InputOAuthCallback) GetQuery() string

type InputPasskeyAssertionResponse

type InputPasskeyAssertionResponse struct {
	Stage             string
	AssertionResponse []byte
}

func (*InputPasskeyAssertionResponse) GetAssertionResponse

func (i *InputPasskeyAssertionResponse) GetAssertionResponse() []byte

func (*InputPasskeyAssertionResponse) GetAuthenticationStage

func (i *InputPasskeyAssertionResponse) GetAuthenticationStage() authn.AuthenticationStage

type InputPasskeyAttestationResponse

type InputPasskeyAttestationResponse struct {
	Stage               string
	AttestationResponse []byte
}

func (*InputPasskeyAttestationResponse) GetAttestationResponse

func (i *InputPasskeyAttestationResponse) GetAttestationResponse() []byte

func (*InputPasskeyAttestationResponse) GetAuthenticationStage

func (i *InputPasskeyAttestationResponse) GetAuthenticationStage() authn.AuthenticationStage

type InputPromptCreatePasskeyAttestationResponse

type InputPromptCreatePasskeyAttestationResponse struct {
	Skipped             bool
	AttestationResponse []byte
}

func (*InputPromptCreatePasskeyAttestationResponse) GetAttestationResponse

func (i *InputPromptCreatePasskeyAttestationResponse) GetAttestationResponse() []byte

func (*InputPromptCreatePasskeyAttestationResponse) IsSkipped

type InputRemoveAuthenticator

type InputRemoveAuthenticator struct {
	Type model.AuthenticatorType
	ID   string
}

func (*InputRemoveAuthenticator) GetAuthenticatorID

func (i *InputRemoveAuthenticator) GetAuthenticatorID() string

func (*InputRemoveAuthenticator) GetAuthenticatorType

func (i *InputRemoveAuthenticator) GetAuthenticatorType() model.AuthenticatorType

type InputRemoveIdentity

type InputRemoveIdentity struct {
	Type model.IdentityType
	ID   string
}

func (*InputRemoveIdentity) GetIdentityID

func (i *InputRemoveIdentity) GetIdentityID() string

func (*InputRemoveIdentity) GetIdentityType

func (i *InputRemoveIdentity) GetIdentityType() model.IdentityType

type InputResendCode

type InputResendCode struct{}

func (*InputResendCode) DoResend

func (i *InputResendCode) DoResend()

type InputResetPassword

type InputResetPassword struct {
	Code     string
	Password string
}

func (*InputResetPassword) GetCode

func (i *InputResetPassword) GetCode() string

func (*InputResetPassword) GetNewPassword

func (i *InputResetPassword) GetNewPassword() string
type InputSelectLoginLink struct{}

func (*InputSelectLoginLink) SetupPrimaryAuthenticatorLoginLinkOTP

func (i *InputSelectLoginLink) SetupPrimaryAuthenticatorLoginLinkOTP()

type InputSelectOOB

type InputSelectOOB struct{}

func (*InputSelectOOB) SetupPrimaryAuthenticatorOOB

func (i *InputSelectOOB) SetupPrimaryAuthenticatorOOB()

type InputSelectTOTP

type InputSelectTOTP struct{}

func (*InputSelectTOTP) SetupTOTP

func (i *InputSelectTOTP) SetupTOTP()

type InputSelectVerifyIdentityViaOOBOTP

type InputSelectVerifyIdentityViaOOBOTP struct{}

func (*InputSelectVerifyIdentityViaOOBOTP) SelectVerifyIdentityViaOOBOTP

func (i *InputSelectVerifyIdentityViaOOBOTP) SelectVerifyIdentityViaOOBOTP()

type InputSelectVerifyIdentityViaWhatsapp

type InputSelectVerifyIdentityViaWhatsapp struct{}

func (*InputSelectVerifyIdentityViaWhatsapp) SelectVerifyIdentityViaWhatsapp

func (i *InputSelectVerifyIdentityViaWhatsapp) SelectVerifyIdentityViaWhatsapp()

type InputSelectWhatsappOTP

type InputSelectWhatsappOTP struct{}

func (*InputSelectWhatsappOTP) SetupPrimaryAuthenticatorWhatsappOTP

func (i *InputSelectWhatsappOTP) SetupPrimaryAuthenticatorWhatsappOTP()

type InputSetupLoginLinkOTP

type InputSetupLoginLinkOTP struct {
	InputType string
	Target    string
}

func (*InputSetupLoginLinkOTP) GetLoginLinkOTPTarget

func (i *InputSetupLoginLinkOTP) GetLoginLinkOTPTarget() string

type InputSetupOOB

type InputSetupOOB struct {
	InputType string
	Target    string
}

func (*InputSetupOOB) GetOOBChannel

func (i *InputSetupOOB) GetOOBChannel() model.AuthenticatorOOBChannel

func (*InputSetupOOB) GetOOBTarget

func (i *InputSetupOOB) GetOOBTarget() string

type InputSetupPassword

type InputSetupPassword struct {
	Stage    string
	Password string
}

func (*InputSetupPassword) GetAuthenticationStage

func (i *InputSetupPassword) GetAuthenticationStage() authn.AuthenticationStage

func (*InputSetupPassword) GetPassword

func (i *InputSetupPassword) GetPassword() string

type InputSetupRecoveryCode

type InputSetupRecoveryCode struct{}

func (*InputSetupRecoveryCode) ViewedRecoveryCodes

func (i *InputSetupRecoveryCode) ViewedRecoveryCodes()

type InputSetupTOTP

type InputSetupTOTP struct {
	Code        string
	DisplayName string
}

func (*InputSetupTOTP) GetTOTP

func (i *InputSetupTOTP) GetTOTP() string

func (*InputSetupTOTP) GetTOTPDisplayName

func (i *InputSetupTOTP) GetTOTPDisplayName() string

type InputSetupWhatsappOTP

type InputSetupWhatsappOTP struct {
	Phone string
}

func (*InputSetupWhatsappOTP) GetWhatsappPhone

func (i *InputSetupWhatsappOTP) GetWhatsappPhone() string
type InputTriggerLoginLink struct {
	AuthenticatorIndex int
}

func (*InputTriggerLoginLink) GetLoginLinkAuthenticatorIndex

func (i *InputTriggerLoginLink) GetLoginLinkAuthenticatorIndex() int

type InputTriggerOOB

type InputTriggerOOB struct {
	AuthenticatorType  string
	AuthenticatorIndex int
}

func (*InputTriggerOOB) GetOOBAuthenticatorIndex

func (i *InputTriggerOOB) GetOOBAuthenticatorIndex() int

func (*InputTriggerOOB) GetOOBAuthenticatorType

func (i *InputTriggerOOB) GetOOBAuthenticatorType() string

type InputTriggerWhatsApp

type InputTriggerWhatsApp struct {
	AuthenticatorIndex int
}

func (*InputTriggerWhatsApp) GetWhatsappAuthenticatorIndex

func (i *InputTriggerWhatsApp) GetWhatsappAuthenticatorIndex() int

type InputUseLoginID

type InputUseLoginID struct {
	LoginIDKey string
	LoginID    string
}

func (*InputUseLoginID) GetLoginID

func (i *InputUseLoginID) GetLoginID() string

func (*InputUseLoginID) GetLoginIDKey

func (i *InputUseLoginID) GetLoginIDKey() string

type InputUseOAuth

type InputUseOAuth struct {
	ProviderAlias    string
	ErrorRedirectURI string
	Prompt           []string
}

func (*InputUseOAuth) GetErrorRedirectURI

func (i *InputUseOAuth) GetErrorRedirectURI() string

func (*InputUseOAuth) GetPrompt

func (i *InputUseOAuth) GetPrompt() []string

func (*InputUseOAuth) GetProviderAlias

func (i *InputUseOAuth) GetProviderAlias() string

type InputVerificationCode

type InputVerificationCode struct {
	Code string
}

func (*InputVerificationCode) GetVerificationCode

func (i *InputVerificationCode) GetVerificationCode() string

type InputVerifyLoginLinkOTP

type InputVerifyLoginLinkOTP struct {
	DeviceToken bool
}

func (*InputVerifyLoginLinkOTP) CreateDeviceToken

func (i *InputVerifyLoginLinkOTP) CreateDeviceToken() bool
func (i *InputVerifyLoginLinkOTP) VerifyLoginLink()

type InputVerifyWhatsappOTP

type InputVerifyWhatsappOTP struct {
	DeviceToken bool
	WhatsappOTP string
}

func (*InputVerifyWhatsappOTP) CreateDeviceToken

func (i *InputVerifyWhatsappOTP) CreateDeviceToken() bool

func (*InputVerifyWhatsappOTP) GetWhatsappOTP

func (i *InputVerifyWhatsappOTP) GetWhatsappOTP() string

type LoginLinkOTPPageQueryState

type LoginLinkOTPPageQueryState string
const (
	LoginLinkOTPPageQueryStateInitial     LoginLinkOTPPageQueryState = ""
	LoginLinkOTPPageQueryStateInvalidCode LoginLinkOTPPageQueryState = "invalid_code"
	LoginLinkOTPPageQueryStateMatched     LoginLinkOTPPageQueryState = "matched"
)

func GetLoginLinkStateFromQuery

func GetLoginLinkStateFromQuery(r *http.Request) LoginLinkOTPPageQueryState

func (*LoginLinkOTPPageQueryState) IsValid

func (s *LoginLinkOTPPageQueryState) IsValid() bool

type LogoutHandler

type LogoutHandler struct {
	ControllerFactory     ControllerFactory
	Database              *appdb.Handle
	TrustProxy            config.TrustProxy
	OAuth                 *config.OAuthConfig
	UIConfig              *config.UIConfig
	SAMLConfig            *config.SAMLConfig
	SessionManager        LogoutSessionManager
	BaseViewModel         *viewmodels.BaseViewModeler
	Renderer              Renderer
	OAuthClientResolver   WebappOAuthClientResolver
	SAMLSLOSessionService SAMLSLOSessionService
	SAMLSLOService        SAMLSLOService
}

func (*LogoutHandler) ServeHTTP

func (h *LogoutHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type LogoutSessionManager

type LogoutSessionManager interface {
	Logout(ctx context.Context, s session.SessionBase, w http.ResponseWriter) ([]session.ListableSession, error)
}

type NoProjectSSOCallbackHandler

type NoProjectSSOCallbackHandler struct {
	ConfigSource    *configsource.ConfigSource
	OAuthStateStore NoProjectSSOCallbackHandlerOAuthStateStore
}

func (*NoProjectSSOCallbackHandler) ServeHTTP

type NoProjectSSOCallbackHandlerOAuthStateStore

type NoProjectSSOCallbackHandlerOAuthStateStore interface {
	RecoverState(ctx context.Context, stateToken string) (state *webappoauth.WebappOAuthState, err error)
}

type OAuthEntrypointEndpointsProvider

type OAuthEntrypointEndpointsProvider interface {
	SelectAccountEndpointURL() *url.URL
}

type OAuthEntrypointHandler

type OAuthEntrypointHandler struct {
	Endpoints OAuthEntrypointEndpointsProvider
}

func (*OAuthEntrypointHandler) ServeHTTP

type OTPCodeService

type OTPCodeService interface {
	VerifyOTP(ctx context.Context, kind otp.Kind, target string, otp string, opts *otp.VerifyOptions) error
	InspectState(ctx context.Context, kind otp.Kind, target string) (*otp.State, error)

	LookupCode(ctx context.Context, purpose otp.Purpose, code string) (target string, err error)
	SetSubmittedCode(ctx context.Context, kind otp.Kind, target string, code string) (*otp.State, error)
}

type PageService

type PageService interface {
	UpdateSession(ctx context.Context, session *webapp.Session) error
	DeleteSession(ctx context.Context, id string) error
	PeekUncommittedChanges(ctx context.Context, session *webapp.Session, fn func(graph *interaction.Graph) error) error
	Get(ctx context.Context, session *webapp.Session) (*interaction.Graph, error)
	GetSession(ctx context.Context, id string) (*webapp.Session, error)
	GetWithIntent(ctx context.Context, session *webapp.Session, intent interaction.Intent) (*interaction.Graph, error)
	PostWithIntent(
		ctx context.Context,
		session *webapp.Session,
		intent interaction.Intent,
		inputFn func() (interface{}, error),
	) (result *webapp.Result, err error)
	PostWithInput(
		ctx context.Context,
		session *webapp.Session,
		inputFn func() (interface{}, error),
	) (result *webapp.Result, err error)
}

type PanicMiddleware

type PanicMiddleware struct {
	ErrorService            *webapp.ErrorService
	BaseViewModel           *viewmodels.BaseViewModeler
	Renderer                Renderer
	Endpoints               PanicMiddlewareEndpointsProvider
	UIImplementationService PanicMiddlewareUIImplementationService
}

func (*PanicMiddleware) Handle

func (m *PanicMiddleware) Handle(next http.Handler) http.Handler

type PanicMiddlewareEndpointsProvider

type PanicMiddlewareEndpointsProvider interface {
	ErrorEndpointURL() *url.URL
}

type PanicMiddlewareUIImplementationService

type PanicMiddlewareUIImplementationService interface {
	GetUIImplementation() config.UIImplementation
}

type PasskeyCreationOptionsHandler

type PasskeyCreationOptionsHandler struct {
	Page     PageService
	Database *appdb.Handle
	Passkey  PasskeyCreationOptionsService
}

func (*PasskeyCreationOptionsHandler) ServeHTTP

type PasskeyCreationOptionsService

type PasskeyCreationOptionsService interface {
	MakeCreationOptions(ctx context.Context, userID string) (*model.WebAuthnCreationOptions, error)
}

type PasskeyRequestOptionsHandler

type PasskeyRequestOptionsHandler struct {
	Page     PageService
	Database *appdb.Handle
	Passkey  PasskeyRequestOptionsService
}

func (*PasskeyRequestOptionsHandler) ServeHTTP

type PasskeyRequestOptionsService

type PasskeyRequestOptionsService interface {
	MakeConditionalRequestOptions(ctx context.Context) (*model.WebAuthnRequestOptions, error)
	MakeModalRequestOptions(ctx context.Context) (*model.WebAuthnRequestOptions, error)
	MakeModalRequestOptionsWithUser(ctx context.Context, userID string) (*model.WebAuthnRequestOptions, error)
}

type Publisher

type Publisher struct {
	AppID       config.AppID
	RedisHandle *appredis.Handle
	Publisher   *pubsub.Publisher
}

func NewPublisher

func NewPublisher(appID config.AppID, handle *appredis.Handle) *Publisher

func (*Publisher) Get

func (p *Publisher) Get() *goredis.Client

func (*Publisher) Publish

func (p *Publisher) Publish(ctx context.Context, s *webapp.Session, msg *WebsocketMessage) error

type Renderer

type Renderer interface {
	// Render renders the template into response body.
	Render(w http.ResponseWriter, r *http.Request, tpl template.Resource, data interface{})
	// RenderHTML is a shorthand of Render that renders HTML.
	RenderHTML(w http.ResponseWriter, r *http.Request, tpl *template.HTML, data interface{})
	RenderStatus(w http.ResponseWriter, req *http.Request, status int, tpl template.Resource, data interface{})
	RenderHTMLStatus(w http.ResponseWriter, r *http.Request, status int, tpl *template.HTML, data interface{})
}

type ResourceManager

type ResourceManager interface {
	Read(ctx context.Context, desc resource.Descriptor, view resource.View) (interface{}, error)
	Resolve(path string) (resource.Descriptor, bool)
}

type ResponseRenderer

type ResponseRenderer struct {
	TemplateEngine *template.Engine
}

func (*ResponseRenderer) Render

func (r *ResponseRenderer) Render(w http.ResponseWriter, req *http.Request, tpl template.Resource, data interface{})

func (*ResponseRenderer) RenderHTML

func (r *ResponseRenderer) RenderHTML(w http.ResponseWriter, req *http.Request, tpl *template.HTML, data interface{})

func (*ResponseRenderer) RenderHTMLStatus

func (r *ResponseRenderer) RenderHTMLStatus(w http.ResponseWriter, req *http.Request, status int, tpl *template.HTML, data interface{})

func (*ResponseRenderer) RenderStatus

func (r *ResponseRenderer) RenderStatus(w http.ResponseWriter, req *http.Request, status int, tpl template.Resource, data interface{})

type ResponseWriter

type ResponseWriter struct {
	Renderer Renderer
}

func (*ResponseWriter) PrepareData

func (w *ResponseWriter) PrepareData(ctx context.Context, err error) map[string]interface{}

func (*ResponseWriter) WriteResponse

func (w *ResponseWriter) WriteResponse(rw http.ResponseWriter, req *http.Request, resp *api.Response)

type ReturnHandler

type ReturnHandler struct {
	ControllerFactory ControllerFactory
	BaseViewModel     *viewmodels.BaseViewModeler
	Renderer          Renderer
}

func (*ReturnHandler) GetData

func (h *ReturnHandler) GetData(r *http.Request, w http.ResponseWriter) (map[string]interface{}, error)

func (*ReturnHandler) ServeHTTP

func (h *ReturnHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RobotsTXTHandler

type RobotsTXTHandler struct {
	Renderer Renderer
}

func (*RobotsTXTHandler) ServeHTTP

func (h *RobotsTXTHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RootHandler

type RootHandler struct {
	AuthenticationConfig *config.AuthenticationConfig
	Cookies              CookieManager
	SignedUpCookie       webapp.SignedUpCookieDef
}

func (*RootHandler) ServeHTTP

func (h *RootHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type SAMLSLOService

type SAMLSLOService interface {
	SendSLORequest(
		ctx context.Context,
		rw http.ResponseWriter,
		r *http.Request,
		sloSession *samlslosession.SAMLSLOSession,
		sp *config.SAMLServiceProviderConfig,
	) error
}

type SAMLSLOSessionService

type SAMLSLOSessionService interface {
	Get(ctx context.Context, sessionID string) (entry *samlslosession.SAMLSLOSession, err error)
	Save(ctx context.Context, session *samlslosession.SAMLSLOSession) (err error)
}

type SSOCallbackHandler

type SSOCallbackHandler struct {
	AuthflowController *AuthflowController
	ErrorRenderer      *ErrorRenderer
	OAuthStateStore    SSOCallbackHandlerOAuthStateStore
	AccountManagement  *accountmanagement.Service
}

func (*SSOCallbackHandler) ServeHTTP

func (h *SSOCallbackHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type SSOCallbackHandlerOAuthStateStore

type SSOCallbackHandlerOAuthStateStore interface {
	PopAndRecoverState(ctx context.Context, stateToken string) (state *webappoauth.WebappOAuthState, err error)
}

type SessionStore

type SessionStore interface {
	Get(ctx context.Context, id string) (session *webapp.Session, err error)
	Update(ctx context.Context, session *webapp.Session) (err error)
}

type SettingsImplementationSwitcherHandler

type SettingsImplementationSwitcherHandler struct {
	SettingV2 http.Handler
}

func (*SettingsImplementationSwitcherHandler) ServeHTTP

type SettingsImplementationSwitcherMiddleware

type SettingsImplementationSwitcherMiddleware struct {
	UIImplementationService SettingsImplementationSwitcherMiddlewareUIImplementationService
}

func (*SettingsImplementationSwitcherMiddleware) Handle

type SettingsImplementationSwitcherMiddlewareUIImplementationService

type SettingsImplementationSwitcherMiddlewareUIImplementationService interface {
	GetSettingsUIImplementation() config.SettingsUIImplementation
}

type TesterAppSessionTokenService

type TesterAppSessionTokenService interface {
	Exchange(ctx context.Context, appSessionToken string) (string, error)
}

type TesterAuthTokensIssuer

type TesterAuthTokensIssuer interface {
	IssueTokensForAuthorizationCode(
		ctx context.Context,
		client *config.OAuthClientConfig,
		r protocol.TokenRequest,
	) (*oauthhandler.HandleResult, error)
	IssueAppSessionToken(ctx context.Context, refreshToken string) (string, *oauth.AppSessionToken, error)
}

type TesterCookieManager

type TesterCookieManager interface {
	ValueCookie(def *httputil.CookieDef, value string) *http.Cookie
}

type TesterHandler

type TesterHandler struct {
	AppID                   config.AppID
	ControllerFactory       ControllerFactory
	OauthEndpointsProvider  oauth.EndpointsProvider
	TesterEndpointsProvider tester.EndpointsProvider
	TesterService           TesterService
	TesterTokenIssuer       TesterAuthTokensIssuer
	OAuthClientResolver     *oauthclient.Resolver
	AppSessionTokenService  TesterAppSessionTokenService
	CookieManager           TesterCookieManager
	Renderer                Renderer
	BaseViewModel           *viewmodels.BaseViewModeler
	UserInfoProvider        TesterUserInfoProvider
	OfflineGrants           TesterOfflineGrantService
}

func (*TesterHandler) ServeHTTP

func (h *TesterHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type TesterOfflineGrantService

type TesterOfflineGrantService interface {
	GetOfflineGrant(ctx context.Context, id string) (*oauth.OfflineGrant, error)
}

type TesterService

type TesterService interface {
	GetToken(
		ctx context.Context,
		appID config.AppID,
		tokenID string,
		consume bool,
	) (*tester.TesterToken, error)
	CreateResult(
		ctx context.Context,
		appID config.AppID,
		result *tester.TesterResult,
	) (*tester.TesterResult, error)
	GetResult(
		ctx context.Context,
		appID config.AppID,
		resultID string,
	) (*tester.TesterResult, error)
}

type TesterState

type TesterState struct {
	Token string `json:"token"`
}

type TesterUserInfoProvider

type TesterUserInfoProvider interface {
	GetUserInfo(ctx context.Context, userID string, clientLike *oauth.ClientLike) (map[string]interface{}, error)
}

type TesterViewModel

type TesterViewModel struct {
	ReturnURI    string
	UserInfoJson string
}

type UserProfile

type UserProfile map[string]interface{}

func GetUserProfile

func GetUserProfile(user *model.User) UserProfile

type WebappOAuthClientResolver

type WebappOAuthClientResolver interface {
	ResolveClient(clientID string) *config.OAuthClientConfig
}

type WebsocketHandler

type WebsocketHandler struct {
	AppID       config.AppID
	RedisHandle *appredis.Handle
	Publisher   *Publisher
}

func (*WebsocketHandler) Accept

func (h *WebsocketHandler) Accept(r *http.Request) (channelName string, err error)

func (*WebsocketHandler) OnRedisSubscribe

func (h *WebsocketHandler) OnRedisSubscribe(r *http.Request) error

func (*WebsocketHandler) ServeHTTP

func (h *WebsocketHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type WebsocketMessage

type WebsocketMessage struct {
	Kind WebsocketMessageKind `json:"kind"`
}

type WebsocketMessageKind

type WebsocketMessageKind string

type WechatCallbackHandler

type WechatCallbackHandler struct {
	ControllerFactory ControllerFactory
	BaseViewModel     *viewmodels.BaseViewModeler
	OAuthStateStore   WechatCallbackHandlerOAuthStateStore
}

WechatCallbackHandler receives WeChat authorization result (code or error) and set it into the web session. Refreshing original auth ui WeChat auth page (/sso/wechat/auth/:alias) will get and consume the result from the web session.

In web, user will use their WeChat app to scan the qr code in auth ui WeChat auth page, then they will complete authorization in their WeChat app and redirect to this endpoint through WeChat. This endpoint will set the result in web session and instruct user go back to the original auth ui. The original auth ui will refresh and proceed.

In native app, the app will receive delegate function call when user click login in with WeChat. Developer needs to implement and obtain WeChat authorization code through native WeChat SDK. After obtaining the code, developer needs to call this endpoint with code through Authgear SDK. At this moment, user can click the proceed button in auth ui WeChat auth page to continue.

func (*WechatCallbackHandler) ServeHTTP

type WechatCallbackHandlerOAuthStateStore

type WechatCallbackHandlerOAuthStateStore interface {
	PopAndRecoverState(ctx context.Context, stateToken string) (state *webappoauth.WebappOAuthState, err error)
}

type WhatsappCloudAPIWebhookHandler

type WhatsappCloudAPIWebhookHandler struct {
	AppID           config.AppID
	WhatsappService WhatsappCloudAPIWebhookWhatsappService
	Credentials     *config.WhatsappCloudAPICredentials
	AppHostSuffixes config.AppHostSuffixes
}

func (*WhatsappCloudAPIWebhookHandler) ServeHTTP

type WhatsappCloudAPIWebhookWhatsappService

type WhatsappCloudAPIWebhookWhatsappService interface {
	UpdateMessageStatus(ctx context.Context, messageID string, status whatsapp.WhatsappMessageStatus, errors []whatsapp.WhatsappStatusError) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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