original_docstring: Find the registration that signed this JWT and return it.
docstring: Find the registration that signed this JWT and return it.
docstring_tokens: Find the registration that signed this JWT and return it .
code: def decode_jwt(self, token):
          """Find the registration that signed this JWT and return it."""
          import jwt
  
          # 1.  Check claims w/o verifying to see if a target is in there.
          # 2.  If target in claims, attempt to verify against the given name.
          # 2a. If decode is successful, return the payload.
          # 2b. If decode is unsuccessful, return a 401.
  
          target_check = jwt.decode(token, verify=False)
          if target_check[ATTR_TARGET] in self.registrations:
              possible_target = self.registrations[target_check[ATTR_TARGET]]
              key = possible_target[ATTR_SUBSCRIPTION][ATTR_KEYS][ATTR_AUTH]
              try:
                  return jwt.decode(token, key, algorithms=["ES256", "HS256"])
              except jwt.exceptions.DecodeError:
                  pass
  
          return self.json_message('No target found in JWT',
                                   status_code=HTTP_UNAUTHORIZED)
code_tokens: def decode_jwt ( self , token ) : import jwt target_check = jwt . decode ( token , verify = False ) if target_check [ ATTR_TARGET ] in self . registrations : possible_target = self . registrations [ target_check [ ATTR_TARGET ] ] key = possible_target [ ATTR_SUBSCRIPTION ] [ ATTR_KEYS ] [ ATTR_AUTH ] try : return jwt . decode ( token , key , algorithms = [ "ES256" , "HS256" ] ) except jwt . exceptions . DecodeError : pass return self . json_message ( 'No target found in JWT' , status_code = HTTP_UNAUTHORIZED )
short_docstring: Find the registration that signed this JWT and return it.
short_docstring_tokens: Find the registration that signed this JWT and return it .
comment: """Find the registration that signed this JWT and return it."""$SEP$# 1.  Check claims w/o verifying to see if a target is in there.$SEP$# 2.  If target in claims, attempt to verify against the given name.$SEP$# 2a. If decode is successful, return the payload.$SEP$# 2b. If decode is unsuccessful, return a 401.