Class Policy
java.lang.Object
com.shapesecurity.salvation2.Policy
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enumprivate static classstatic interfacestatic interfacestatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SourceExpressionDirectiveprivate booleanprivate List<Policy.NamedDirective> private final Map<FetchDirectiveKind, SourceExpressionDirective> private SourceExpressionDirectiveprivate FrameAncestorsDirectiveprivate SourceExpressionDirectiveprivate PluginTypesDirectiveprivate RFC7230Tokenprivate ReportUriDirectiveprivate SandboxDirectiveprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(String name, List<String> values, Directive.DirectiveErrorConsumer directiveErrorConsumer) booleanallowsApplicationManifest(Optional<URLWithScheme> source, Optional<URLWithScheme> origin) booleanallowsConnection(Optional<URLWithScheme> source, Optional<URLWithScheme> origin) booleanbooleanallowsExternalScript(Optional<String> nonce, Optional<String> integrity, Optional<URLWithScheme> scriptUrl, Optional<Boolean> parserInserted, Optional<URLWithScheme> origin) booleanallowsExternalStyle(Optional<String> nonce, Optional<URLWithScheme> styleUrl, Optional<URLWithScheme> origin) booleanallowsFont(Optional<URLWithScheme> source, Optional<URLWithScheme> origin) booleanallowsFormAction(Optional<URLWithScheme> to, Optional<Boolean> redirected, Optional<URLWithScheme> redirectedTo, Optional<URLWithScheme> origin) booleanallowsFrame(Optional<URLWithScheme> source, Optional<URLWithScheme> origin) booleanallowsFrameAncestor(Optional<URLWithScheme> source, Optional<URLWithScheme> origin) booleanallowsImage(Optional<URLWithScheme> source, Optional<URLWithScheme> origin) booleanallowsInlineScript(Optional<String> nonce, Optional<String> source, Optional<Boolean> parserInserted) booleanallowsInlineStyle(Optional<String> nonce, Optional<String> source) booleanallowsJavascriptUrlNavigation(Optional<String> source, Optional<URLWithScheme> origin) booleanallowsMedia(Optional<URLWithScheme> source, Optional<URLWithScheme> origin) booleanallowsNavigation(Optional<URLWithScheme> to, Optional<Boolean> redirected, Optional<URLWithScheme> redirectedTo, Optional<URLWithScheme> origin) booleanallowsObject(Optional<URLWithScheme> source, Optional<URLWithScheme> origin) booleanallowsPlugin(Optional<MediaType> mediaType) booleanallowsPrefetch(Optional<URLWithScheme> source, Optional<URLWithScheme> origin) booleanallowsScriptAsAttribute(Optional<String> source) booleanallowsStyleAsAttribute(Optional<String> source) booleanallowsWorker(Optional<URLWithScheme> source, Optional<URLWithScheme> origin) baseUri()booleanprivate static Stringprivate booleandoesElementMatchSourceListForTypeAndSource(Policy.InlineType type, Optional<String> nonce, Optional<String> source, Optional<Boolean> parserInserted) static booleandoesUrlMatchSourceListInOrigin(URLWithScheme url, HostSourceDirective list, Optional<URLWithScheme> origin) (package private) static voidprivate static booleanhostPartMatches(String A, String B) private static StringnormalizeBase64Url(String input) static PolicyparseSerializedCSP(String serialized, Policy.PolicyErrorConsumer policyErrorConsumer) static PolicyListparseSerializedCSPList(String serialized, Policy.PolicyListErrorConsumer policyListErrorConsumer) private static booleanpathPartMatches(String pathA, String pathB) private static booleanportPartMatches(int A, int portB, String schemeB) booleanreportTo()sandbox()private static booleanschemePartMatches(String A, String B) voidsetBlockAllMixedContent(boolean value) voidsetReportTo(RFC7230Token token) voidsetUpgradeInsecureRequests(boolean value) private static StringstripLeadingWhitespace(String string) private static StringstripTrailingWhitespace(String string) toString()boolean
-
Field Details
-
directives
-
baseUri
-
blockAllMixedContent
private boolean blockAllMixedContent -
formAction
-
frameAncestors
-
pluginTypes
-
reportTo
-
reportUri
-
sandbox
-
upgradeInsecureRequests
private boolean upgradeInsecureRequests -
fetchDirectives
-
-
Constructor Details
-
Policy
private Policy()
-
-
Method Details
-
parseSerializedCSPList
@Nonnull public static PolicyList parseSerializedCSPList(String serialized, Policy.PolicyListErrorConsumer policyListErrorConsumer) -
parseSerializedCSP
@Nonnull public static Policy parseSerializedCSP(String serialized, Policy.PolicyErrorConsumer policyErrorConsumer) -
add
public Directive add(String name, List<String> values, Directive.DirectiveErrorConsumer directiveErrorConsumer) -
remove
-
toString
-
baseUri
-
blockAllMixedContent
public boolean blockAllMixedContent() -
setBlockAllMixedContent
public void setBlockAllMixedContent(boolean value) -
formAction
-
frameAncestors
-
pluginTypes
-
reportTo
-
setReportTo
-
reportUri
-
sandbox
-
upgradeInsecureRequests
public boolean upgradeInsecureRequests() -
setUpgradeInsecureRequests
public void setUpgradeInsecureRequests(boolean value) -
getFetchDirective
-
allowsExternalScript
public boolean allowsExternalScript(Optional<String> nonce, Optional<String> integrity, Optional<URLWithScheme> scriptUrl, Optional<Boolean> parserInserted, Optional<URLWithScheme> origin) -
allowsInlineScript
-
allowsScriptAsAttribute
-
allowsEval
public boolean allowsEval() -
allowsFormAction
public boolean allowsFormAction(Optional<URLWithScheme> to, Optional<Boolean> redirected, Optional<URLWithScheme> redirectedTo, Optional<URLWithScheme> origin) -
allowsExternalStyle
public boolean allowsExternalStyle(Optional<String> nonce, Optional<URLWithScheme> styleUrl, Optional<URLWithScheme> origin) -
allowsInlineStyle
-
allowsStyleAsAttribute
-
allowsFrame
-
allowsFrameAncestor
-
allowsConnection
-
allowsFont
-
allowsImage
-
allowsApplicationManifest
public boolean allowsApplicationManifest(Optional<URLWithScheme> source, Optional<URLWithScheme> origin) -
allowsMedia
-
allowsObject
-
allowsPrefetch
-
allowsWorker
-
allowsPlugin
-
getGoverningDirectiveForEffectiveDirective
public Optional<SourceExpressionDirective> getGoverningDirectiveForEffectiveDirective(FetchDirectiveKind kind) -
doesElementMatchSourceListForTypeAndSource
-
normalizeBase64Url
-
doesUrlMatchSourceListInOrigin
public static boolean doesUrlMatchSourceListInOrigin(URLWithScheme url, HostSourceDirective list, Optional<URLWithScheme> origin) -
schemePartMatches
-
hostPartMatches
-
portPartMatches
-
pathPartMatches
-
enforceAscii
-
stripLeadingWhitespace
-
stripTrailingWhitespace
-
collect
-