コード例 #1
0
    def _get_header(self) -> dict:
        """
        Returns the header of the JSON Web Token

        :rtype dict
        :return: token header
        """
        token_header = self._token_string.split('.')[0].encode()
        try:
            return extract_header(token_header, DecodeError)
        except DecodeError:
            auth_error_token_decode()
コード例 #2
0
    def _get_payload(self) -> AzureJWTClaims:
        """
        Returns the payload of the JSON Web Token

        The returned JWTClaims object can be used to validate and retrieve claims defined in the token payload.

        :rtype AzureJWTClaims
        :return: An object containing the claims of the JSON Web Token
        """
        try:
            self._jwk_public_key = self._get_jwk_public_key()
            return jwt.decode(self._token_string, self._jwk_public_key)
        except DecodeError:
            auth_error_token_decode()
        except BadSignatureError:
            auth_error_token_signature_invalid()