Class CriticalHeaderParamsDeferral


  • public class CriticalHeaderParamsDeferral
    extends java.lang.Object
    Critical (crit) header parameters deferral policy.
    Version:
    2020-04-17
    Author:
    Vladimir Dzhuvinov
    See Also:
    CriticalHeaderParamsAware
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void ensureHeaderPasses​(JWEHeader header)
      Throws a JOSE exception if the specified JWE header doesn't pass the critical header parameters check.
      java.util.Set<java.lang.String> getDeferredCriticalHeaderParams()
      Returns the names of the critical (crit) header parameters that are deferred to the application for processing.
      java.util.Set<java.lang.String> getProcessedCriticalHeaderParams()
      Returns the names of the critical (crit) header parameters that are understood and processed.
      boolean headerPasses​(Header header)
      Returns true if the specified header passes the critical parameters check.
      void setDeferredCriticalHeaderParams​(java.util.Set<java.lang.String> defCritHeaders)
      Sets the names of the critical (crit) header parameters that are deferred to the application for processing.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CriticalHeaderParamsDeferral

        public CriticalHeaderParamsDeferral()
    • Method Detail

      • getProcessedCriticalHeaderParams

        public java.util.Set<java.lang.String> getProcessedCriticalHeaderParams()
        Returns the names of the critical (crit) header parameters that are understood and processed.
        Returns:
        Empty immutable set.
      • getDeferredCriticalHeaderParams

        public java.util.Set<java.lang.String> getDeferredCriticalHeaderParams()
        Returns the names of the critical (crit) header parameters that are deferred to the application for processing.
        Returns:
        The names of the critical header parameters that are deferred to the application for processing, as an unmodifiable set, empty set if none.
      • setDeferredCriticalHeaderParams

        public void setDeferredCriticalHeaderParams​(java.util.Set<java.lang.String> defCritHeaders)
        Sets the names of the critical (crit) header parameters that are deferred to the application for processing.
        Parameters:
        defCritHeaders - The names of the critical header parameters that are deferred to the application for processing, empty set or null if none.
      • headerPasses

        public boolean headerPasses​(Header header)
        Returns true if the specified header passes the critical parameters check.
        Parameters:
        header - The JWS or JWE header to check. Must not be null.
        Returns:
        true if the header passes, false if the header contains one or more critical header parameters which are not marked for deferral to the application.
      • ensureHeaderPasses

        public void ensureHeaderPasses​(JWEHeader header)
                                throws JOSEException
        Throws a JOSE exception if the specified JWE header doesn't pass the critical header parameters check.
        Parameters:
        header - The JWE header to check. Must not be null.
        Throws:
        JOSEException - If the JWE header doesn't pass the check.