web

package
v0.0.0-...-122f59b Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
View Source
var AppLogoDark = resource.RegisterResource(ImageDescriptor{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 ComponentsHTML = []*template.HTML{
	TemplateWebHTMLHeadHTML,
	TemplateWebGeneratedAssetHTML,
	TemplateWebHeaderHTML,
	TemplateWebNavBarHTML,
	TemplateWebErrorHTML,
	TemplateWebMessageBarHTML,
	TemplateWebAlternativeStepsHTML,
	TemplateWebPhoneOTPAlternativeStepsHTML,
	TemplateWebUseRecoveryCodeHTML,
	TemplateWebPasswordPolicyHTML,
	TemplateWebPageFrameHTML,
	TemplateWebWidePageFrameHTML,
	TemplateWebModalHTML,
	TemplateWebWatermarkHTML,
	TemplateWebRecoveryCodeHTML,
	TemplateWebPasswordInputHTML,
	TemplateWebPasswordStrengthMeterHTML,
	TemplateWebTutorialHTML,
	TemplateWebTermsOfServiceAndPrivacyPolicyFooterHTML,
	TemplateWebAuthflowBranchHTML,
	TemplateWebAuthflowForgotPasswordAlternativesHTML,

	TemplateWebAuthflowV2LayoutHTML,
	TemplateWebAuthflowV2HTMLHeadHTML,
	TemplateWebAuthflowV2GeneratedAssetHTML,
	TemplateWebAuthflowV2PageFrameHTML,
	TemplateWebAuthflowV2HeaderHTML,
	TemplateWebAuthflowV2DividerHTML,
	TemplateWebAuthflowV2AlertMessageHTML,
	TemplateWebAuthflowV2OTPInputHTML,
	TemplateWebAuthflowV2PasswordInputHTML,
	TemplateWebAuthflowV2PasswordStrengthMeterHTML,
	TemplateWebAuthflowV2PasswordFieldHTML,
	TemplateWebAuthflowV2NewPasswordFieldHTML,
	TemplateWebAuthflowV2PhoneInputHTML,
	TemplateWebAuthflowV2ErrorHTML,
	TemplateWebAuthflowV2PasswordPolicyHTML,
	TemplateWebAuthflowV2BranchHTML,
	TemplateWebAuthflowV2LockoutHTML,
	TemplateWebAuthflowV2ForgotPasswordAlternativesHTML,
	TemplateWebAuthflowV2ErrorPageLayoutHTML,
	TemplateWebAuthflowV2DeviceTokenCheckboxHTML,
	TemplateWebAuthflowV2TermsOfServiceAndPrivacyPolicyFooterHTML,
	TemplateWebAuthflowV2WatermarkHTML,
}
View Source
var ComponentsPlainText = []*template.PlainText{
	TemplateWebRecoveryCodeTXT,
}
View Source
var DependencySet = wire.NewSet(
	wire.Struct(new(StaticAssetResolver), "*"),
)
View Source
var Favicon = resource.RegisterResource(ImageDescriptor{Name: "favicon"})
View Source
var StaticAssetResources = map[string]resource.Descriptor{
	"app-logo":      AppLogo,
	"app-logo-dark": AppLogoDark,
	"favicon":       Favicon,

	"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 TemplateWebAuthflowV2BranchHTML = template.RegisterHTML("web/authflowv2/__authflow_branch.html")
View Source
var TemplateWebAuthflowV2DeviceTokenCheckboxHTML = template.RegisterHTML("web/authflowv2/__device_token_checkbox.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 TemplateWebAuthflowV2LockoutHTML = template.RegisterHTML("web/authflowv2/__lockout.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 TemplateWebAuthflowV2TermsOfServiceAndPrivacyPolicyFooterHTML = template.RegisterHTML("web/authflowv2/__toc_pp_footer.html")
View Source
var TemplateWebAuthflowV2WatermarkHTML = template.RegisterHTML("web/authflowv2/__watermark.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 TemplateWebTermsOfServiceAndPrivacyPolicyFooterHTML = template.RegisterHTML("web/__toc_pp_footer.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 CSPDirectives

func CSPDirectives(opts CSPDirectivesOptions) ([]string, error)

func GetCSPNonce

func GetCSPNonce(ctx context.Context) string

func GetHashedName

func GetHashedName(file string) string

func LookLikeAHash

func LookLikeAHash(s string) bool

func WithCSPNonce

func WithCSPNonce(ctx context.Context, nonce string) context.Context

Types

type CSPDirectivesOptions

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

type CSPHostSource

type CSPHostSource struct {
	Scheme string
	Host   string
}

func (CSPHostSource) CSPLevel

func (s CSPHostSource) CSPLevel() int

func (CSPHostSource) String

func (s CSPHostSource) String() string

type CSPKeywordSourceLevel1

type CSPKeywordSourceLevel1 string
const (
	CSPSourceNone         CSPKeywordSourceLevel1 = "'none'"
	CSPSourceSelf         CSPKeywordSourceLevel1 = "'self'"
	CSPSourceUnsafeInline CSPKeywordSourceLevel1 = "'unsafe-inline'"
)

func (CSPKeywordSourceLevel1) CSPLevel

func (_ CSPKeywordSourceLevel1) CSPLevel() int

func (CSPKeywordSourceLevel1) String

func (s CSPKeywordSourceLevel1) String() string

type CSPKeywordSourceLevel3

type CSPKeywordSourceLevel3 string
const (
	CSPSourceStrictDynamic CSPKeywordSourceLevel3 = "'strict-dynamic'"
)

func (CSPKeywordSourceLevel3) CSPLevel

func (_ CSPKeywordSourceLevel3) CSPLevel() int

func (CSPKeywordSourceLevel3) String

func (s CSPKeywordSourceLevel3) String() string

type CSPNonceSource

type CSPNonceSource struct {
	Nonce string
}

func (CSPNonceSource) CSPLevel

func (s CSPNonceSource) CSPLevel() int

func (CSPNonceSource) String

func (s CSPNonceSource) String() string

type CSPSchemeSource

type CSPSchemeSource struct {
	Scheme string
}

func (CSPSchemeSource) CSPLevel

func (s CSPSchemeSource) CSPLevel() int

func (CSPSchemeSource) String

func (s CSPSchemeSource) String() string

type CSPSource

type CSPSource interface {
	CSPLevel() int
	String() string
}

type CSPSources

type CSPSources []CSPSource

func (CSPSources) Len

func (s CSPSources) Len() int

func (CSPSources) Less

func (s CSPSources) Less(i, j int) bool

func (CSPSources) String

func (s CSPSources) String() string

func (CSPSources) Swap

func (s CSPSources) Swap(i, j int)

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(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 {
	Manifest *Manifest
	// contains filtered or unexported fields
}

func NewDefaultGlobalEmbeddedResourceManager

func NewDefaultGlobalEmbeddedResourceManager() (*GlobalEmbeddedResourceManager, error)

func NewGlobalEmbeddedResourceManager

func NewGlobalEmbeddedResourceManager(manifest *Manifest) (*GlobalEmbeddedResourceManager, error)

func (*GlobalEmbeddedResourceManager) AssetName

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

func (*GlobalEmbeddedResourceManager) Close

func (*GlobalEmbeddedResourceManager) GetManifestContext

func (m *GlobalEmbeddedResourceManager) GetManifestContext() *ManifestContext

func (*GlobalEmbeddedResourceManager) ManifestFilePath

func (m *GlobalEmbeddedResourceManager) ManifestFilePath() string

func (*GlobalEmbeddedResourceManager) Open

type ImageDescriptor

type ImageDescriptor struct {
	Name string
}

func (ImageDescriptor) FindResources

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

func (ImageDescriptor) MatchResource

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

func (ImageDescriptor) UpdateResource

func (ImageDescriptor) ViewResources

func (a ImageDescriptor) ViewResources(resources []resource.ResourceFile, rawView resource.View) (interface{}, error)

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(resources []resource.ResourceFile, rawView resource.View) (interface{}, error)

type Manifest

type Manifest struct {
	ResourceDir string
	Name        string
	// contains filtered or unexported fields
}

type ManifestContext

type ManifestContext struct {
	Content map[string]string
}

type ResourceManager

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

type StaticAsset

type StaticAsset struct {
	Path string
	Data []byte
}

type StaticAssetResolver

type StaticAssetResolver struct {
	Context           context.Context
	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(id string) bool

func (*StaticAssetResolver) StaticAssetURL

func (r *StaticAssetResolver) StaticAssetURL(id string) (string, error)

Jump to

Keyboard shortcuts

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