当前位置: 首页>>代码示例>>Python>>正文


Python JWT.get方法代码示例

本文整理汇总了Python中jwkest.jwt.JWT.get方法的典型用法代码示例。如果您正苦于以下问题:Python JWT.get方法的具体用法?Python JWT.get怎么用?Python JWT.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jwkest.jwt.JWT的用法示例。


在下文中一共展示了JWT.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_access_token_contains_nonce

# 需要导入模块: from jwkest.jwt import JWT [as 别名]
# 或者: from jwkest.jwt.JWT import get [as 别名]
    def test_access_token_contains_nonce(self):
        """
        If present in the Authentication Request, Authorization Servers MUST
        include a nonce Claim in the ID Token with the Claim Value being the
        nonce value sent in the Authentication Request.
        If the client does not supply a nonce parameter, it SHOULD not be
        included in the `id_token`.

        See http://openid.net/specs/openid-connect-core-1_0.html#IDToken
        """
        code = self._create_code()

        post_data = self._auth_code_post_data(code=code.code)

        response = self._post_request(post_data)

        response_dic = json.loads(response.content.decode('utf-8'))
        id_token = JWT().unpack(response_dic['id_token'].encode('utf-8')).payload()

        self.assertEqual(id_token.get('nonce'), FAKE_NONCE)

        # Client does not supply a nonce parameter.
        code.nonce = ''
        code.save()

        response = self._post_request(post_data)
        response_dic = json.loads(response.content.decode('utf-8'))

        id_token = JWT().unpack(response_dic['id_token'].encode('utf-8')).payload()

        self.assertEqual(id_token.get('nonce'), None)
开发者ID:RaduGatej,项目名称:django-oidc-provider,代码行数:33,代码来源:test_token_endpoint.py

示例2: test_additional_idtoken_processing_hook_one_element_in_list

# 需要导入模块: from jwkest.jwt import JWT [as 别名]
# 或者: from jwkest.jwt.JWT import get [as 别名]
    def test_additional_idtoken_processing_hook_one_element_in_list(self):
        """
        Test custom function for setting OIDC_IDTOKEN_PROCESSING_HOOK.
        """
        code = self._create_code()

        post_data = self._auth_code_post_data(code=code.code)

        response = self._post_request(post_data)

        response_dic = json.loads(response.content.decode('utf-8'))
        id_token = JWT().unpack(response_dic['id_token'].encode('utf-8')).payload()

        self.assertEqual(id_token.get('test_idtoken_processing_hook'), FAKE_RANDOM_STRING)
        self.assertEqual(id_token.get('test_idtoken_processing_hook_user_email'), self.user.email)
开发者ID:RaduGatej,项目名称:django-oidc-provider,代码行数:17,代码来源:test_token_endpoint.py

示例3: client_id_from_id_token

# 需要导入模块: from jwkest.jwt import JWT [as 别名]
# 或者: from jwkest.jwt.JWT import get [as 别名]
def client_id_from_id_token(id_token):
    """
    Extracts the client id from a JSON Web Token (JWT).
    Returns a string or None.
    """
    payload = JWT().unpack(id_token).payload()
    return payload.get('aud', None)
开发者ID:ByteInternet,项目名称:django-oidc-provider,代码行数:9,代码来源:token.py

示例4: client_id_from_id_token

# 需要导入模块: from jwkest.jwt import JWT [as 别名]
# 或者: from jwkest.jwt.JWT import get [as 别名]
def client_id_from_id_token(id_token):
    """
    Extracts the client id from a JSON Web Token (JWT).
    Returns a string or None.
    """
    payload = JWT().unpack(id_token).payload()
    aud = payload.get('aud', None)
    if aud is None:
        return None
    if isinstance(aud, list):
        return aud[0]
    return aud
开发者ID:juanifioren,项目名称:django-oidc-provider,代码行数:14,代码来源:token.py

示例5: test_custom_sub_generator

# 需要导入模块: from jwkest.jwt import JWT [as 别名]
# 或者: from jwkest.jwt.JWT import get [as 别名]
    def test_custom_sub_generator(self):
        """
        Test custom function for setting OIDC_IDTOKEN_SUB_GENERATOR.
        """
        code = self._create_code()

        post_data = self._auth_code_post_data(code=code.code)

        response = self._post_request(post_data)

        response_dic = json.loads(response.content.decode('utf-8'))
        id_token = JWT().unpack(response_dic['id_token'].encode('utf-8')).payload()

        self.assertEqual(id_token.get('sub'), self.user.email)
开发者ID:RaduGatej,项目名称:django-oidc-provider,代码行数:16,代码来源:test_token_endpoint.py

示例6: test_id_token_contains_at_hash

# 需要导入模块: from jwkest.jwt import JWT [as 别名]
# 或者: from jwkest.jwt.JWT import get [as 别名]
    def test_id_token_contains_at_hash(self):
        """
        If access_token is included, the id_token SHOULD contain an at_hash.
        """
        code = self._create_code()

        post_data = self._auth_code_post_data(code=code.code)

        response = self._post_request(post_data)

        response_dic = json.loads(response.content.decode('utf-8'))
        id_token = JWT().unpack(response_dic['id_token'].encode('utf-8')).payload()

        self.assertTrue(id_token.get('at_hash'))
开发者ID:ByteInternet,项目名称:django-oidc-provider,代码行数:16,代码来源:test_token_endpoint.py


注:本文中的jwkest.jwt.JWT.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。