クラス OAuth2AuthorizationManagers

java.lang.ObjectSE
org.springframework.security.oauth2.core.authorization.OAuth2AuthorizationManagers

public final class OAuth2AuthorizationManagers extends ObjectSE
OAuth 2.0 固有の AuthorizationManager を作成するための便利なクラス。
導入:
6.2
関連事項:
  • メソッドの詳細

    • hasScope

      public static <T> AuthorizationManager<T> hasScope(StringSE scope)
      Authentication が SCOPE_scope 権限を持つことを必要とする AuthorizationManager を作成します。

      例: hasScope("read") を呼び出す場合、各認証には値が SCOPE_read である GrantedAuthority が必要になります。

      これは AuthorityAuthorizationManager#hasAuthority("SCOPE_read") を呼び出すことと同じです。

      型パラメーター:
      T - 安全なオブジェクト
      パラメーター:
      scope - 必要なスコープ値
      戻り値:
      "SCOPE_scope" 権限を必要とする AuthorizationManager
    • hasAnyScope

      public static <T> AuthorizationManager<T> hasAnyScope(StringSE... scopes)
      Authentication が SCOPE_scope1SCOPE_scope2、... SCOPE_scopeN のうち少なくとも 1 つの権限を持つことを要求する AuthorizationManager を作成します。

      例: hasAnyScope("read", "write") を呼び出す場合、各認証には少なくとも SCOPE_read または SCOPE_write の値を持つ GrantedAuthority が必要になります。

      これは AuthorityAuthorizationManager#hasAnyAuthority("SCOPE_read", "SCOPE_write") を呼び出すことと同じです。

      型パラメーター:
      T - 安全なオブジェクト
      パラメーター:
      scopes - 許可するスコープ値
      戻り値:
      "SCOPE_scope1"SCOPE_scope2、... SCOPE_scopeN のうち少なくとも 1 つの権限を必要とする AuthorizationManager