Class UnprotectedHeader


  • @Immutable
    public final class UnprotectedHeader
    extends java.lang.Object
    JSON Web Signature (JWS) or JSON Web Encryption (JWE) unprotected header (in a JSON serialisation). This class is immutable.
    Version:
    2021-10-05
    Author:
    Alexander Martynov, Vladimir Dzhuvinov
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  UnprotectedHeader.Builder
      Builder for constructing an unprotected JWS or JWE header.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Set<java.lang.String> getIncludedParams()
      Gets the names of the included parameters in this unprotected header.
      java.lang.String getKeyID()
      Gets the key ID (kid) parameter.
      java.lang.Object getParam​(java.lang.String name)
      Gets a parameter.
      static UnprotectedHeader parse​(java.util.Map<java.lang.String,​java.lang.Object> jsonObject)
      Parses an unprotected header from the specified JSON object.
      java.util.Map<java.lang.String,​java.lang.Object> toJSONObject()
      Returns a JSON object representation of this unprotected header.
      • Methods inherited from class java.lang.Object

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

      • getKeyID

        public java.lang.String getKeyID()
        Gets the key ID (kid) parameter.
        Returns:
        The key ID parameter, null if not specified.
      • getParam

        public java.lang.Object getParam​(java.lang.String name)
        Gets a parameter.
        Parameters:
        name - The name of the parameter. Must not be null.
        Returns:
        The parameter, null if not specified.
      • getIncludedParams

        public java.util.Set<java.lang.String> getIncludedParams()
        Gets the names of the included parameters in this unprotected header.
        Returns:
        The included parameters.
      • toJSONObject

        public java.util.Map<java.lang.String,​java.lang.Object> toJSONObject()
        Returns a JSON object representation of this unprotected header.
        Returns:
        The JSON object, empty if no parameters are specified.
      • parse

        public static UnprotectedHeader parse​(java.util.Map<java.lang.String,​java.lang.Object> jsonObject)
                                       throws java.text.ParseException
        Parses an unprotected header from the specified JSON object.
        Parameters:
        jsonObject - The JSON object, null if not specified.
        Returns:
        The unprotected header or null.
        Throws:
        java.text.ParseException - If the JSON object couldn't be parsed to a valid unprotected header.