Class LoginContentSecurityPolicy
java.lang.Object
com.irurueta.authserver.authorization.api.web.login.LoginContentSecurityPolicy
Builds the content security policy of the server-rendered pages from the
BrandingProperties: same-origin
resources only and no framing, except that images may also be data: URIs (the QR code of an authenticator
app, rendered in memory so its secret never becomes a resource of its own) and, when the branding logo is an
absolute http(s) URL, come from its origin (img-src 'self' data: <scheme://host[:port]>). A relative
logo URL is same-origin and needs nothing more.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.springframework.beans.factory.ObjectProvider<BrandingProperties> Provider of the configured branding; absent in web slices that do not enable the properties.static final StringPolicy of the pages when the logo, if any, is served by this application.Schemes whose origin is added for an absolute logo URL. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
DEFAULT_POLICY
Policy of the pages when the logo, if any, is served by this application. Its last directive lists the image sources, so the origin of an absolute logo URL is appended to it.- See Also:
-
WEB_SCHEMES
Schemes whose origin is added for an absolute logo URL. -
branding
Provider of the configured branding; absent in web slices that do not enable the properties.
-
-
Constructor Details
-
LoginContentSecurityPolicy
public LoginContentSecurityPolicy()
-
-
Method Details
-
policy
Builds the policy.- Returns:
DEFAULT_POLICY, with the logo's origin added to itsimg-srcdirective when the logo is an absolutehttp(s)URL.
-
originOf
Extracts the origin of an absolutehttp(s)URL.- Parameters:
url- the URL; may be empty.- Returns:
scheme://host[:port]in lower case, or empty when the URL is relative, nothttp(s), has no host or cannot be parsed.
-