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


Python ENFORCE_JWT_SCOPES.is_enabled方法代码示例

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


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

示例1: _get_use_asymmetric_key_value

# 需要导入模块: from openedx.core.djangoapps.oauth_dispatch.toggles import ENFORCE_JWT_SCOPES [as 别名]
# 或者: from openedx.core.djangoapps.oauth_dispatch.toggles.ENFORCE_JWT_SCOPES import is_enabled [as 别名]
def _get_use_asymmetric_key_value(is_restricted, use_asymmetric_key):
    """
    Returns the value to use for use_asymmetric_key.
    """
    # TODO: (ARCH-162)
    # If JWT scope enforcement is enabled, we need to sign tokens
    # given to restricted applications with a key that
    # other IDAs do not have access to. This prevents restricted
    # applications from getting access to API endpoints available
    # on other IDAs which have not yet been protected with the
    # scope-related DRF permission classes. Once all endpoints have
    # been protected, we can enable all IDAs to use the same new
    # (asymmetric) key.
    if use_asymmetric_key is None:
        use_asymmetric_key = ENFORCE_JWT_SCOPES.is_enabled() and is_restricted
    return use_asymmetric_key
开发者ID:mitocw,项目名称:edx-platform,代码行数:18,代码来源:jwt.py

示例2: should_expire_access_token

# 需要导入模块: from openedx.core.djangoapps.oauth_dispatch.toggles import ENFORCE_JWT_SCOPES [as 别名]
# 或者: from openedx.core.djangoapps.oauth_dispatch.toggles.ENFORCE_JWT_SCOPES import is_enabled [as 别名]
 def should_expire_access_token(cls, application):
     set_token_expired = not ENFORCE_JWT_SCOPES.is_enabled()
     jwt_not_requested = get_request_or_stub().POST.get('token_type', '').lower() != 'jwt'
     restricted_application = cls.objects.filter(application=application).exists()
     return restricted_application and (jwt_not_requested or set_token_expired)
开发者ID:mitocw,项目名称:edx-platform,代码行数:7,代码来源:models.py


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