@NotThreadSafe public class CSP2SourceList extends Object implements Serializable
CSP2Directive). It's
just a convenient way to build a CSP directive value.| Modifier and Type | Field and Description |
|---|---|
static String |
HASH_PREFIX |
static String |
HASH_SUFFIX |
static String |
KEYWORD_NONE |
static String |
KEYWORD_SELF |
static String |
KEYWORD_UNSAFE_EVAL |
static String |
KEYWORD_UNSAFE_INLINE |
static String |
NONCE_PREFIX |
static String |
NONCE_SUFFIX |
| Constructor and Description |
|---|
CSP2SourceList() |
| Modifier and Type | Method and Description |
|---|---|
CSP2SourceList |
addHash(com.helger.security.messagedigest.EMessageDigestAlgorithm eMDAlgo,
byte[] aHashValue)
Add the provided nonce value.
|
CSP2SourceList |
addHash(com.helger.security.messagedigest.EMessageDigestAlgorithm eMDAlgo,
String sHashBase64Value)
Add the provided Base64 encoded hash value.
|
CSP2SourceList |
addHost(com.helger.commons.url.ISimpleURL aHost)
Add a host
|
CSP2SourceList |
addHost(String sHost)
Add a host
|
CSP2SourceList |
addKeywordNone()
source expression 'none' represents an empty set of URIs
|
CSP2SourceList |
addKeywordSelf()
source expression 'self' represents the set of URIs which are in the same
origin as the protected resource
|
CSP2SourceList |
addKeywordUnsafeEval() |
CSP2SourceList |
addKeywordUnsafeInline()
source expression 'unsafe-inline' represents content supplied inline in the
resource itself
|
CSP2SourceList |
addMimeType(com.helger.commons.mime.IMimeType aMimeType)
Add a MIME type (for plugin-types)
|
CSP2SourceList |
addNonce(byte[] aNonceValue)
Add the provided nonce value.
|
CSP2SourceList |
addNonce(String sNonceBase64Value)
Add the provided Base64 encoded nonce value.
|
CSP2SourceList |
addScheme(String sScheme)
Add a scheme
|
boolean |
equals(Object o) |
String |
getAsString() |
int |
getExpressionCount() |
int |
hashCode() |
String |
toString() |
public static final String KEYWORD_NONE
public static final String KEYWORD_SELF
public static final String KEYWORD_UNSAFE_INLINE
public static final String KEYWORD_UNSAFE_EVAL
public static final String NONCE_PREFIX
public static final String NONCE_SUFFIX
public static final String HASH_PREFIX
public static final String HASH_SUFFIX
@Nonnegative public int getExpressionCount()
@Nonnull public CSP2SourceList addScheme(@Nonnull @Nonempty String sScheme)
sScheme - Scheme in the format scheme ":"@Nonnull public CSP2SourceList addHost(@Nonnull com.helger.commons.url.ISimpleURL aHost)
aHost - Host to add. Must be a valid URL.@Nonnull public CSP2SourceList addHost(@Nonnull @Nonempty String sHost)
sHost - Host to add. Must be a valid URL or a star prefixed version.@Nonnull public CSP2SourceList addMimeType(@Nonnull com.helger.commons.mime.IMimeType aMimeType)
aMimeType - MIME type to add. May not be null.@Nonnull public CSP2SourceList addKeywordNone()
@Nonnull public CSP2SourceList addKeywordSelf()
@Nonnull public CSP2SourceList addKeywordUnsafeInline()
@Nonnull public CSP2SourceList addKeywordUnsafeEval()
@Nonnull public CSP2SourceList addNonce(@Nonnull @Nonempty byte[] aNonceValue)
NONCE_SUFFIX are added automatically. The byte array is
automatically Bas64 encoded!aNonceValue - The plain nonce value. May not be null.@Nonnull public CSP2SourceList addNonce(@Nonnull @Nonempty String sNonceBase64Value)
NONCE_SUFFIX are added automatically.sNonceBase64Value - The Base64 encoded nonce value@Nonnull public CSP2SourceList addHash(@Nonnull com.helger.security.messagedigest.EMessageDigestAlgorithm eMDAlgo, @Nonnull @Nonempty byte[] aHashValue)
HASH_SUFFIX are added automatically. The byte array is automatically
Bas64 encoded!eMDAlgo - The message digest algorithm used. May only
EMessageDigestAlgorithm.SHA_256,
EMessageDigestAlgorithm.SHA_384 or
EMessageDigestAlgorithm.SHA_512. May not be null.aHashValue - The plain hash digest value. May not be null.@Nonnull public CSP2SourceList addHash(@Nonnull com.helger.security.messagedigest.EMessageDigestAlgorithm eMDAlgo, @Nonnull String sHashBase64Value)
HASH_SUFFIX are added automatically.eMDAlgo - The message digest algorithm used. May only
EMessageDigestAlgorithm.SHA_256,
EMessageDigestAlgorithm.SHA_384 or
EMessageDigestAlgorithm.SHA_512. May not be null.sHashBase64Value - The Base64 encoded hash value@Nonnull public String getAsString()
Copyright © 2016–2019 Philip Helger. All rights reserved.