com.nimbusds.jose
Class DefaultJWEHeaderFilter

java.lang.Object
  extended by com.nimbusds.jose.DefaultHeaderFilter
      extended by com.nimbusds.jose.DefaultJWEHeaderFilter
All Implemented Interfaces:
HeaderFilter, JWEHeaderFilter

@ThreadSafe
public class DefaultJWEHeaderFilter
extends DefaultHeaderFilter
implements JWEHeaderFilter

JSON Web Encryption (JWE) header filter implementation. Intended to be incorporated by JWEDecrypter implementations. This class is thread-safe.

Version:
$version$ (2013-03-27)
Author:
Vladimir Dzhuvinov

Constructor Summary
DefaultJWEHeaderFilter(Set<JWEAlgorithm> algs, Set<EncryptionMethod> encs)
          Creates a new JWE header filter.
DefaultJWEHeaderFilter(Set<JWEAlgorithm> algs, Set<EncryptionMethod> encs, Set<String> acceptedParams)
          Creates a new JWE header filter.
 
Method Summary
 Set<JWEAlgorithm> getAcceptedAlgorithms()
          Gets the names of the accepted JWE algorithms.
 Set<EncryptionMethod> getAcceptedEncryptionMethods()
          Gets the names of the accepted encryption methods.
 void setAcceptedAlgorithms(Set<JWEAlgorithm> acceptedAlgs)
          Sets the names of the accepted JWE algorithms.
 void setAcceptedEncryptionMethods(Set<EncryptionMethod> acceptedEncs)
          Sets the names of the accepted encryption methods.
 void setAcceptedParameters(Set<String> acceptedParams)
          Sets the names of the accepted header parameters.
 Set<JWEAlgorithm> supportedAlgorithms()
          Returns the names of the supported JWE algorithms.
 Set<EncryptionMethod> supportedEncryptionMethods()
          Returns the names of the supported encryption methods.
 
Methods inherited from class com.nimbusds.jose.DefaultHeaderFilter
getAcceptedParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.nimbusds.jose.HeaderFilter
getAcceptedParameters
 

Constructor Detail

DefaultJWEHeaderFilter

public DefaultJWEHeaderFilter(Set<JWEAlgorithm> algs,
                              Set<EncryptionMethod> encs)
Creates a new JWE header filter. The accepted algorithms and encryption methods are set to equal the specified supported ones. The accepted header parameters are set to match JWEHeader.getReservedParameterNames().

Parameters:
algs - The supported JWE algorithms. Used to bound the accepted algorithms. Must not be null.
encs - The supported encryption methods. Used to bound the accepted encryption methods. Must not be null.

DefaultJWEHeaderFilter

public DefaultJWEHeaderFilter(Set<JWEAlgorithm> algs,
                              Set<EncryptionMethod> encs,
                              Set<String> acceptedParams)
Creates a new JWE header filter. The accepted algorithms and encryption methods are set to equal the specified supported ones.

Parameters:
algs - The supported JWE algorithms. Used to bound the accepted algorithms. Must not be null.
encs - The supported encryption methods. Used to bound the accepted encryption methods. Must not be null.
acceptedParams - The accepted JWE header parameters. Must contain at least the alg and enc parameters. Must not be null.
Method Detail

supportedAlgorithms

public Set<JWEAlgorithm> supportedAlgorithms()
Returns the names of the supported JWE algorithms. Used to bound the accepted algorithms.

Returns:
The supported JWE algorithms as a read-only set, empty set if none.

getAcceptedAlgorithms

public Set<JWEAlgorithm> getAcceptedAlgorithms()
Description copied from interface: JWEHeaderFilter
Gets the names of the accepted JWE algorithms. These correspond to the alg JWE header parameter.

Specified by:
getAcceptedAlgorithms in interface JWEHeaderFilter
Returns:
The accepted JWE algorithms, as a read-only set, empty set if none.

setAcceptedAlgorithms

public void setAcceptedAlgorithms(Set<JWEAlgorithm> acceptedAlgs)
Description copied from interface: JWEHeaderFilter
Sets the names of the accepted JWE algorithms. These correspond to the alg JWE header parameter.

Specified by:
setAcceptedAlgorithms in interface JWEHeaderFilter
Parameters:
acceptedAlgs - The accepted JWE algorithms. Must be a subset of the supported algorithms and not null.

supportedEncryptionMethods

public Set<EncryptionMethod> supportedEncryptionMethods()
Returns the names of the supported encryption methods. Used to bound the accepted encryption methods.

Returns:
The supported encryption methods as a read-only set, empty set if none.

getAcceptedEncryptionMethods

public Set<EncryptionMethod> getAcceptedEncryptionMethods()
Description copied from interface: JWEHeaderFilter
Gets the names of the accepted encryption methods. These correspond to the enc JWE header parameter.

Specified by:
getAcceptedEncryptionMethods in interface JWEHeaderFilter
Returns:
The accepted encryption methods, as a read-only set, empty set if none.

setAcceptedEncryptionMethods

public void setAcceptedEncryptionMethods(Set<EncryptionMethod> acceptedEncs)
Description copied from interface: JWEHeaderFilter
Sets the names of the accepted encryption methods. These correspond to the enc JWE header parameter.

Specified by:
setAcceptedEncryptionMethods in interface JWEHeaderFilter
Parameters:
acceptedEncs - The accepted encryption methods. Must be a subset of the supported encryption methods and not null.

setAcceptedParameters

public void setAcceptedParameters(Set<String> acceptedParams)
Description copied from interface: HeaderFilter
Sets the names of the accepted header parameters.

Specified by:
setAcceptedParameters in interface HeaderFilter
Overrides:
setAcceptedParameters in class DefaultHeaderFilter
Parameters:
acceptedParams - The accepted header parameters. Must contain at least the alg parameter for JWS headers or the alg and enc parameters for JWE headers. Must not be null.


Copyright © 2013 NimbusDS. All Rights Reserved.