web

package
v0.0.0-...-fe7d464 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: Apache-2.0 Imports: 30 Imported by: 1

Documentation

Index

Constants

View Source
const AppAssetsURLDirname = "static"
View Source
const GeneratedAssetsURLDirname = "shared-assets"

Variables

View Source
var AppBackgroundImage = resource.RegisterResource(NonLocaleAwareImageDescriptor{Name: "app_background_image", SizeLimit: 500 * 1024})
View Source
var AppBackgroundImageDark = resource.RegisterResource(NonLocaleAwareImageDescriptor{Name: "app_background_image_dark", SizeLimit: 500 * 1024})
View Source
var AppLogoDark = resource.RegisterResource(LocaleAwareImageDescriptor{Name: "app_logo_dark"})
View Source
var AuthgearAuthflowV2DarkThemeCSS = resource.RegisterResource(CSSDescriptor{
	Path: path.Join(AppAssetsURLDirname, "authgear-authflowv2-dark-theme.css"),
})
View Source
var AuthgearAuthflowV2LightThemeCSS = resource.RegisterResource(CSSDescriptor{
	Path: path.Join(AppAssetsURLDirname, "authgear-authflowv2-light-theme.css"),
})
View Source
var AuthgearDarkThemeCSS = resource.RegisterResource(CSSDescriptor{
	Path: path.Join(AppAssetsURLDirname, "authgear-dark-theme.css"),
})
View Source
var AuthgearLightThemeCSS = resource.RegisterResource(CSSDescriptor{
	Path: path.Join(AppAssetsURLDirname, "authgear-light-theme.css"),
})
View Source
var BaseComponentsHTML = []*template.HTML{
	TemplateWebHTMLHeadHTML,
	TemplateWebGeneratedAssetHTML,
	TemplateWebHeaderHTML,
	TemplateWebNavBarHTML,
	TemplateWebErrorHTML,
	TemplateWebMessageBarHTML,
	TemplateWebAlternativeStepsHTML,
	TemplateWebPhoneOTPAlternativeStepsHTML,
	TemplateWebUseRecoveryCodeHTML,
	TemplateWebPasswordPolicyHTML,
	TemplateWebPageFrameHTML,
	TemplateWebWidePageFrameHTML,
	TemplateWebModalHTML,
	TemplateWebWatermarkHTML,
	TemplateWebRecoveryCodeHTML,
	TemplateWebPasswordInputHTML,
	TemplateWebPasswordStrengthMeterHTML,
	TemplateWebTutorialHTML,
	TemplateWebTermsOfServiceAndPrivacyPolicyFooterHTML,
	TemplateWebAuthflowBranchHTML,
	TemplateWebAuthflowForgotPasswordAlternativesHTML,
	TemplateWebTranslationMessageHTML,

	TemplateWebAuthflowV2LayoutHTML,
	TemplateWebAuthflowV2SettingsLayoutHTML,
	TemplateWebAuthflowV2HTMLHeadHTML,
	TemplateWebAuthflowV2LoadBotProtectionHTML,
	TemplateWebAuthflowV2GeneratedAssetHTML,
	TemplateWebAuthflowV2BasePageFrameHTML,
	TemplateWebAuthflowV2DialogHTML,
	TemplateWebAuthflowV2BotProtectionWidgetHTML,
	TemplateWebAuthflowV2BotProtectionFormInputHTML,
	TemplateWebAuthflowV2BotProtectionControllerHTML,
	TemplateWebAuthflowV2BotProtectionControllerAttrHTML,
	TemplateWebAuthflowV2BotProtectionDialogHTML,
	TemplateWebAuthflowV2HeaderHTML,
	TemplateWebAuthflowV2DividerHTML,
	TemplateWebAuthflowV2AlertMessageHTML,
	TemplateWebAuthflowV2OTPInputHTML,
	TemplateWebAuthflowV2PasswordInputHTML,
	TemplateWebAuthflowV2PasswordStrengthMeterHTML,
	TemplateWebAuthflowV2PasswordFieldHTML,
	TemplateWebAuthflowV2NewPasswordFieldHTML,
	TemplateWebAuthflowV2PhoneInputHTML,
	TemplateWebAuthflowV2ErrorHTML,
	TemplateWebAuthflowV2PasswordPolicyHTML,
	TemplateWebAuthflowV2BranchHTML,
	TemplateWebAuthflowV2LockoutHTML,
	TemplateWebAuthflowV2ForgotPasswordAlternativesHTML,
	TemplateWebAuthflowV2ErrorPageLayoutHTML,
	TemplateWebAuthflowV2DeviceTokenCheckboxHTML,
	TemplateWebAuthflowV2TermsOfServiceAndPrivacyPolicyFooterHTML,
	TemplateWebAuthflowV2WatermarkHTML,
	TemplateWebAuthflowV2CSRFErrorPageLayoutHTML,
	TemplateWebAuthflowV2BrandLogoHTML,
	TemplateWebAuthflowV2SettingsItemHTML,
	TemplateWebAuthflowV2NavBar,
	TemplateWebAuthflowV2DateInputHTML,
	TemplateWebAuthflowV2UserProfilePic,
	TemplateWebAuthflowV2SettingsRadioHTML,
	TemplateWebAuthflowV2SettingsTextInput,
	TemplateWebAuthflowV2SettingsDialog,
	TemplateWebAuthflowV2LocaleInputHTML,
	TemplateWebAuthflowV2TimezoneInput,
	TemplateWebAuthflowV2CountryInput,
	TemplateWebAuthflowV2SelectInput,
}
View Source
var CSRFAndroidInsturction = resource.RegisterResource(StaticImageDescriptor{Name: "csrf-android-instruction"})
View Source
var CSRFChromeInsturction = resource.RegisterResource(StaticImageDescriptor{Name: "csrf-chrome-instruction"})
View Source
var CSRFIOSInsturction = resource.RegisterResource(StaticImageDescriptor{Name: "csrf-ios-instruction"})
View Source
var CSRFSamsungInsturction = resource.RegisterResource(StaticImageDescriptor{Name: "csrf-samsung-instruction"})
View Source
var ComponentsHTML []*template.HTML
View Source
var ComponentsPlainText = []*template.PlainText{
	TemplateWebRecoveryCodeTXT,
}
View Source
var DirectAccessDisableComponentsHTML []*template.HTML
View Source
var SettingsComponentsHTML []*template.HTML
View Source
var StaticAssetResources = map[string]resource.Descriptor{
	"app-logo":                  AppLogo,
	"app-logo-dark":             AppLogoDark,
	"favicon":                   Favicon,
	"app-background-image":      AppBackgroundImage,
	"app-background-image-dark": AppBackgroundImageDark,

	"csrf-ios-instruction":     CSRFIOSInsturction,
	"csrf-android-instruction": CSRFAndroidInsturction,
	"csrf-chrome-instruction":  CSRFChromeInsturction,
	"csrf-samsung-instruction": CSRFSamsungInsturction,

	"authgear-light-theme.css":            AuthgearLightThemeCSS,
	"authgear-dark-theme.css":             AuthgearDarkThemeCSS,
	"authgear-authflowv2-light-theme.css": AuthgearAuthflowV2LightThemeCSS,
	"authgear-authflowv2-dark-theme.css":  AuthgearAuthflowV2DarkThemeCSS,
}
View Source
var TemplateWebAlternativeStepsHTML = template.RegisterHTML("web/__alternatives.html")
View Source
var TemplateWebAuthflowBranchHTML = template.RegisterHTML("web/__authflow_branch.html")
View Source
var TemplateWebAuthflowForgotPasswordAlternativesHTML = template.RegisterHTML("web/__authflow_forgot_password_alternatives.html")
View Source
var TemplateWebAuthflowV2AlertMessageHTML = template.RegisterHTML("web/authflowv2/__alert_message.html")
View Source
var TemplateWebAuthflowV2BasePageFrameHTML = template.RegisterHTML("web/authflowv2/__base_page_frame.html")
View Source
var TemplateWebAuthflowV2BotProtectionControllerAttrHTML = template.RegisterHTML("web/authflowv2/__bot_protection_controller_attr.html")
View Source
var TemplateWebAuthflowV2BotProtectionControllerHTML = template.RegisterHTML("web/authflowv2/__bot_protection_controller.html")
View Source
var TemplateWebAuthflowV2BotProtectionDialogHTML = template.RegisterHTML("web/authflowv2/__bot_protection_dialog.html")
View Source
var TemplateWebAuthflowV2BotProtectionFormInputHTML = template.RegisterHTML("web/authflowv2/__bot_protection_form_input.html")
View Source
var TemplateWebAuthflowV2BotProtectionWidgetHTML = template.RegisterHTML("web/authflowv2/__bot_protection_widget.html")
View Source
var TemplateWebAuthflowV2BranchHTML = template.RegisterHTML("web/authflowv2/__authflow_branch.html")
View Source
var TemplateWebAuthflowV2BrandLogoHTML = template.RegisterHTML("web/authflowv2/__brand_logo.html")
View Source
var TemplateWebAuthflowV2CSRFErrorPageLayoutHTML = template.RegisterHTML("web/authflowv2/__csrf_error_page_layout.html")
View Source
var TemplateWebAuthflowV2CountryInput = template.RegisterHTML("web/authflowv2/__country_input.html")
View Source
var TemplateWebAuthflowV2DateInputHTML = template.RegisterHTML("web/authflowv2/__date_input.html")
View Source
var TemplateWebAuthflowV2DeviceTokenCheckboxHTML = template.RegisterHTML("web/authflowv2/__device_token_checkbox.html")
View Source
var TemplateWebAuthflowV2DialogHTML = template.RegisterHTML("web/authflowv2/__dialog.html")
View Source
var TemplateWebAuthflowV2DividerHTML = template.RegisterHTML("web/authflowv2/__divider.html")
View Source
var TemplateWebAuthflowV2ErrorHTML = template.RegisterHTML("web/authflowv2/__error.html")
View Source
var TemplateWebAuthflowV2ErrorPageLayoutHTML = template.RegisterHTML("web/authflowv2/__error_page_layout.html")
View Source
var TemplateWebAuthflowV2ForgotPasswordAlternativesHTML = template.RegisterHTML("web/authflowv2/__forgot_password_alternatives.html")
View Source
var TemplateWebAuthflowV2GeneratedAssetHTML = template.RegisterHTML("web/authflowv2/__generated_asset.html")
View Source
var TemplateWebAuthflowV2HTMLHeadHTML = template.RegisterHTML("web/authflowv2/__html_head.html")
View Source
var TemplateWebAuthflowV2HeaderHTML = template.RegisterHTML("web/authflowv2/__header.html")
View Source
var TemplateWebAuthflowV2LayoutHTML = template.RegisterHTML("web/authflowv2/layout.html")

TODO: This file could be overridable per app, depends on the project plan in future

View Source
var TemplateWebAuthflowV2LoadBotProtectionHTML = template.RegisterHTML("web/authflowv2/__load_bot_protection.html")
View Source
var TemplateWebAuthflowV2LocaleInputHTML = template.RegisterHTML("web/authflowv2/__locale_input.html")
View Source
var TemplateWebAuthflowV2LockoutHTML = template.RegisterHTML("web/authflowv2/__lockout.html")
View Source
var TemplateWebAuthflowV2NavBar = template.RegisterHTML("web/authflowv2/__navbar.html")
View Source
var TemplateWebAuthflowV2NewPasswordFieldHTML = template.RegisterHTML("web/authflowv2/__new_password_field.html")
View Source
var TemplateWebAuthflowV2OTPInputHTML = template.RegisterHTML("web/authflowv2/__otp_input.html")
View Source
var TemplateWebAuthflowV2PageFrameHTML = template.RegisterHTML("web/authflowv2/__page_frame.html")
View Source
var TemplateWebAuthflowV2PasswordFieldHTML = template.RegisterHTML("web/authflowv2/__password_field.html")
View Source
var TemplateWebAuthflowV2PasswordInputHTML = template.RegisterHTML("web/authflowv2/__password_input.html")
View Source
var TemplateWebAuthflowV2PasswordPolicyHTML = template.RegisterHTML("web/authflowv2/__password_policy.html")
View Source
var TemplateWebAuthflowV2PasswordStrengthMeterHTML = template.RegisterHTML("web/authflowv2/__password_strength_meter.html")
View Source
var TemplateWebAuthflowV2PhoneInputHTML = template.RegisterHTML("web/authflowv2/__phone_input.html")
View Source
var TemplateWebAuthflowV2SelectInput = template.RegisterHTML("web/authflowv2/__select_input.html")
View Source
var TemplateWebAuthflowV2SettingsDialog = template.RegisterHTML("web/authflowv2/__settings_dialog.html")
View Source
var TemplateWebAuthflowV2SettingsItemHTML = template.RegisterHTML("web/authflowv2/__settings_item.html")
View Source
var TemplateWebAuthflowV2SettingsLayoutHTML = template.RegisterHTML("web/authflowv2/settings_layout.html")
View Source
var TemplateWebAuthflowV2SettingsRadioHTML = template.RegisterHTML("web/authflowv2/__settings_radio.html")
View Source
var TemplateWebAuthflowV2SettingsTextInput = template.RegisterHTML("web/authflowv2/__settings_text_input.html")
View Source
var TemplateWebAuthflowV2TermsOfServiceAndPrivacyPolicyFooterHTML = template.RegisterHTML("web/authflowv2/__toc_pp_footer.html")
View Source
var TemplateWebAuthflowV2TimezoneInput = template.RegisterHTML("web/authflowv2/__timezone_input.html")
View Source
var TemplateWebAuthflowV2UserProfilePic = template.RegisterHTML("web/authflowv2/__settings_user_profile_pic.html")
View Source
var TemplateWebAuthflowV2WatermarkHTML = template.RegisterHTML("web/authflowv2/__watermark.html")
View Source
var TemplateWebDirectAccessDisableV2PageFrameHTML = template.RegisterHTML("web/authflowv2/__direct_access_disable_page_frame.html")
View Source
var TemplateWebErrorHTML = template.RegisterHTML("web/__error.html")
View Source
var TemplateWebGeneratedAssetHTML = template.RegisterHTML("web/__generated_asset.html")
View Source
var TemplateWebHTMLHeadHTML = template.RegisterHTML("web/__html_head.html")
View Source
var TemplateWebHeaderHTML = template.RegisterHTML("web/__header.html")
View Source
var TemplateWebMessageBarHTML = template.RegisterHTML("web/__message_bar.html")
View Source
var TemplateWebModalHTML = template.RegisterHTML("web/__modal.html")
View Source
var TemplateWebNavBarHTML = template.RegisterHTML("web/__nav_bar.html")
View Source
var TemplateWebPageFrameHTML = template.RegisterHTML("web/__page_frame.html")
View Source
var TemplateWebPasswordInputHTML = template.RegisterHTML("web/__password_input.html")
View Source
var TemplateWebPasswordPolicyHTML = template.RegisterHTML("web/__password_policy.html")
View Source
var TemplateWebPasswordStrengthMeterHTML = template.RegisterHTML("web/__password_strength_meter.html")
View Source
var TemplateWebPhoneOTPAlternativeStepsHTML = template.RegisterHTML("web/__phone_otp_alternatives.html")
View Source
var TemplateWebRecoveryCodeHTML = template.RegisterHTML("web/__recovery_code.html")
View Source
var TemplateWebRecoveryCodeTXT = template.RegisterPlainText("web/__recovery_code.txt")
View Source
var TemplateWebSettingsV2PageFrameHTML = template.RegisterHTML("web/authflowv2/__settings_page_frame.html")
View Source
var TemplateWebTermsOfServiceAndPrivacyPolicyFooterHTML = template.RegisterHTML("web/__toc_pp_footer.html")
View Source
var TemplateWebTranslationMessageHTML = template.RegisterHTML("web/__translation_message.html")
View Source
var TemplateWebTutorialHTML = template.RegisterHTML("web/__tutorial.html")
View Source
var TemplateWebUseRecoveryCodeHTML = template.RegisterHTML("web/__use_recovery_code.html")
View Source
var TemplateWebWatermarkHTML = template.RegisterHTML("web/__watermark.html")
View Source
var TemplateWebWidePageFrameHTML = template.RegisterHTML("web/__wide_page_frame.html")
View Source
var UnsupportedImageFile = apierrors.BadRequest.WithReason("UnsupportedImageFile")

Functions

func GetHashedName

func GetHashedName(file string) string

func LookLikeAHash

func LookLikeAHash(s string) bool

Types

type CSPDirectivesOptions

type CSPDirectivesOptions struct {
	Nonce string
	// FrameAncestors supports the redirect approach used by the custom UI.
	// The custom UI loads the redirect URI with an iframe.
	FrameAncestors []string
}

type CSSDescriptor

type CSSDescriptor struct {
	Path string
}

func (CSSDescriptor) FindResources

func (d CSSDescriptor) FindResources(fs resource.Fs) ([]resource.Location, error)

func (CSSDescriptor) MatchResource

func (d CSSDescriptor) MatchResource(path string) (*resource.Match, bool)

func (CSSDescriptor) UpdateResource

func (d CSSDescriptor) UpdateResource(_ context.Context, _ []resource.ResourceFile, resrc *resource.ResourceFile, data []byte) (*resource.ResourceFile, error)

func (CSSDescriptor) ViewResources

func (d CSSDescriptor) ViewResources(ctx context.Context, resources []resource.ResourceFile, rawView resource.View) (interface{}, error)

type EmbeddedResourceManager

type EmbeddedResourceManager interface {
	AssetName(key string) (name string, err error)
}

type GlobalEmbeddedResourceManager

type GlobalEmbeddedResourceManager struct {
	Impl GlobalEmbeddedResourceManagerImpl
}

func NewDefaultGlobalEmbeddedResourceManager

func NewDefaultGlobalEmbeddedResourceManager() (*GlobalEmbeddedResourceManager, error)

func (*GlobalEmbeddedResourceManager) AssetName

func (m *GlobalEmbeddedResourceManager) AssetName(key string) (name string, err error)

func (*GlobalEmbeddedResourceManager) Open

type GlobalEmbeddedResourceManagerEmbed

type GlobalEmbeddedResourceManagerEmbed struct {
	EmbedFS                               embed.FS
	EmbedFSRoot                           string
	ManifestFilenameRelativeToEmbedFSRoot string
	Manifest                              map[string]string
}

func (*GlobalEmbeddedResourceManagerEmbed) AssetName

func (m *GlobalEmbeddedResourceManagerEmbed) AssetName(key string) (name string, err error)

func (*GlobalEmbeddedResourceManagerEmbed) Open

type GlobalEmbeddedResourceManagerImpl

type GlobalEmbeddedResourceManagerImpl interface {
	AssetName(key string) (name string, err error)
	Open(name string) (http.File, error)
}

type GlobalEmbeddedResourceManagerWorkdir

type GlobalEmbeddedResourceManagerWorkdir struct {
	Manifest *globalEmbeddedResourceManagerManifest
	// contains filtered or unexported fields
}

func NewGlobalEmbeddedResourceManagerWorkdir

func NewGlobalEmbeddedResourceManagerWorkdir(manifest *globalEmbeddedResourceManagerManifest) (*GlobalEmbeddedResourceManagerWorkdir, error)

func (*GlobalEmbeddedResourceManagerWorkdir) AssetName

func (m *GlobalEmbeddedResourceManagerWorkdir) AssetName(key string) (name string, err error)

func (*GlobalEmbeddedResourceManagerWorkdir) Open

type JavaScriptDescriptor

type JavaScriptDescriptor struct {
	Path string
}

func (JavaScriptDescriptor) FindResources

func (d JavaScriptDescriptor) FindResources(fs resource.Fs) ([]resource.Location, error)

func (JavaScriptDescriptor) MatchResource

func (d JavaScriptDescriptor) MatchResource(path string) (*resource.Match, bool)

func (JavaScriptDescriptor) UpdateResource

func (JavaScriptDescriptor) ViewResources

func (d JavaScriptDescriptor) ViewResources(ctx context.Context, resources []resource.ResourceFile, rawView resource.View) (interface{}, error)

type LocaleAwareImageDescriptor

type LocaleAwareImageDescriptor struct {
	Name      string
	SizeLimit int
}

func (LocaleAwareImageDescriptor) FindResources

func (a LocaleAwareImageDescriptor) FindResources(fs resource.Fs) ([]resource.Location, error)

func (LocaleAwareImageDescriptor) GetSizeLimit

func (a LocaleAwareImageDescriptor) GetSizeLimit() int

func (LocaleAwareImageDescriptor) MatchResource

func (a LocaleAwareImageDescriptor) MatchResource(path string) (*resource.Match, bool)

func (LocaleAwareImageDescriptor) UpdateResource

func (LocaleAwareImageDescriptor) ViewResources

func (a LocaleAwareImageDescriptor) ViewResources(ctx context.Context, resources []resource.ResourceFile, rawView resource.View) (interface{}, error)

type NewGlobalEmbeddedResourceManagerEmbedOptions

type NewGlobalEmbeddedResourceManagerEmbedOptions struct {
	EmbedFS                               embed.FS
	EmbedFSRoot                           string
	ManifestFilenameRelativeToEmbedFSRoot string
}

type NonLocaleAwareImageDescriptor

type NonLocaleAwareImageDescriptor struct {
	Name      string
	SizeLimit int
}

func (NonLocaleAwareImageDescriptor) FindResources

func (NonLocaleAwareImageDescriptor) GetSizeLimit

func (a NonLocaleAwareImageDescriptor) GetSizeLimit() int

func (NonLocaleAwareImageDescriptor) MatchResource

func (a NonLocaleAwareImageDescriptor) MatchResource(path string) (*resource.Match, bool)

func (NonLocaleAwareImageDescriptor) UpdateResource

func (NonLocaleAwareImageDescriptor) ViewResources

func (a NonLocaleAwareImageDescriptor) ViewResources(ctx context.Context, resources []resource.ResourceFile, rawView resource.View) (interface{}, error)

type ResourceManager

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

type StaticAsset

type StaticAsset struct {
	Path string
	Data []byte
}

type StaticAssetResolver

type StaticAssetResolver struct {
	Localization      *config.LocalizationConfig
	HTTPOrigin        httputil.HTTPOrigin
	HTTPProto         httputil.HTTPProto
	WebAppCDNHost     config.WebAppCDNHost
	Resources         ResourceManager
	EmbeddedResources EmbeddedResourceManager
}

func (*StaticAssetResolver) GeneratedStaticAssetURL

func (r *StaticAssetResolver) GeneratedStaticAssetURL(key string) (string, error)

func (*StaticAssetResolver) HasAppSpecificAsset

func (r *StaticAssetResolver) HasAppSpecificAsset(ctx context.Context, id string) bool

func (*StaticAssetResolver) StaticAssetURL

func (r *StaticAssetResolver) StaticAssetURL(ctx context.Context, id string) (string, error)

type StaticImageDescriptor

type StaticImageDescriptor struct {
	Name string
}

func (StaticImageDescriptor) FindResources

func (a StaticImageDescriptor) FindResources(fs resource.Fs) ([]resource.Location, error)

func (StaticImageDescriptor) MatchResource

func (a StaticImageDescriptor) MatchResource(path string) (*resource.Match, bool)

func (StaticImageDescriptor) UpdateResource

func (StaticImageDescriptor) ViewResources

func (a StaticImageDescriptor) ViewResources(ctx context.Context, resources []resource.ResourceFile, rawView resource.View) (interface{}, error)

type UIImplementationService

type UIImplementationService struct {
	UIConfig                       *config.UIConfig
	GlobalUIImplementation         config.GlobalUIImplementation
	GlobalUISettingsImplementation config.GlobalUISettingsImplementation
}

func (*UIImplementationService) GetSettingsUIImplementation

func (s *UIImplementationService) GetSettingsUIImplementation() config.SettingsUIImplementation

func (*UIImplementationService) GetUIImplementation

func (s *UIImplementationService) GetUIImplementation() config.UIImplementation

Jump to

Keyboard shortcuts

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