當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。