com.nimbusds.jose
Class DefaultJWSHeaderFilter

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

@ThreadSafe
public class DefaultJWSHeaderFilter
extends DefaultHeaderFilter
implements JWSHeaderFilter

JSON Web Signature (JWS) header filter implementation. Intended to be incorporated by JWSVerifier implementations. This class is thread-safe.

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

Constructor Summary
DefaultJWSHeaderFilter(Set<JWSAlgorithm> algs)
          Creates a new JWS header filter.
DefaultJWSHeaderFilter(Set<JWSAlgorithm> algs, Set<String> acceptedParams)
          Creates a new JWS header filter.
 
Method Summary
 Set<JWSAlgorithm> getAcceptedAlgorithms()
          Gets the names of the accepted JWS algorithms.
 void setAcceptedAlgorithms(Set<JWSAlgorithm> acceptedAlgs)
          Sets the names of the accepted JWS algorithms.
 void setAcceptedParameters(Set<String> acceptedParams)
          Sets the names of the accepted header parameters.
 Set<JWSAlgorithm> supportedAlgorithms()
          Returns the names of the supported JWS algorithms.
 
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

DefaultJWSHeaderFilter

public DefaultJWSHeaderFilter(Set<JWSAlgorithm> algs)
Creates a new JWS header filter. The accepted algorithms are set to equal the specified supported ones. The accepted header parameters are set to match JWSHeader.getReservedParameterNames().

Parameters:
algs - The supported JWS algorithms. Used to bound the accepted algorithms. Must not be null.

DefaultJWSHeaderFilter

public DefaultJWSHeaderFilter(Set<JWSAlgorithm> algs,
                              Set<String> acceptedParams)
Creates a new JWS header filter. The accepted algorithms are set to equal the specified supported ones.

Parameters:
algs - The supported JWS algorithms. Used to bound the accepted algorithms. Must not be null.
acceptedParams - The accepted JWS header parameters. Must contain at least the alg parameter and must not be null.
Method Detail

supportedAlgorithms

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

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

getAcceptedAlgorithms

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

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

setAcceptedAlgorithms

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

Specified by:
setAcceptedAlgorithms in interface JWSHeaderFilter
Parameters:
acceptedAlgs - The accepted JWS algorithms. Must be a subset of the supported algorithms 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.