def verify_signed_jwt_with_certs(jwt, certs, audience=None):
 jwt = _helpers._to_bytes(jwt)
 if (jwt.count('.') != 2):
  raise AppIdentityError('Wrong number of segments in token: {0}'.format(jwt))
 (header, payload, signature) = jwt.split('.')
 message_to_sign = ((header + '.') + payload)
 signature = _helpers._urlsafe_b64decode(signature)
 payload_bytes = _helpers._urlsafe_b64decode(payload)
 try:
  payload_dict = json.loads(_helpers._from_bytes(payload_bytes))
 except:
  raise AppIdentityError("Can't parse token: {0}".format(payload_bytes))
 _verify_signature(message_to_sign, signature, certs.values())
 _verify_time_range(payload_dict)
 _check_audience(payload_dict, audience)
 return payload_dict

def verify_signed_jwt_with_certs ( jwt , certs , audience = None ) : jwt = _helpers . _to_bytes ( jwt ) if ( jwt . count ( '.' ) != 2 ) : raise AppIdentityError ( 'Wrong number of segments in token: {0}' . format ( jwt ) ) ( header , payload , signature ) = jwt . split ( '.' ) message_to_sign = ( ( header + '.' ) + payload ) signature = _helpers . _urlsafe_b64decode ( signature ) payload_bytes = _helpers . _urlsafe_b64decode ( payload ) try : payload_dict = json . loads ( _helpers . _from_bytes ( payload_bytes ) ) except : raise AppIdentityError ( "Can't parse token: {0}" . format ( payload_bytes ) ) _verify_signature ( message_to_sign , signature , certs . values ( ) ) _verify_time_range ( payload_dict ) _check_audience ( payload_dict , audience ) return payload_dict
verify a jwt against public certs .