クラス SimpleAuthorityMapper

java.lang.ObjectSE
org.springframework.security.core.authority.mapping.SimpleAuthorityMapper
実装されたすべてのインターフェース:
org.springframework.beans.factory.InitializingBeanGrantedAuthoritiesMapper

public final class SimpleAuthorityMapper extends ObjectSE implements GrantedAuthoritiesMapper, org.springframework.beans.factory.InitializingBean
簡単な 1 対 1 の GrantedAuthoritiesMapper。これにより、権限名の大文字小文字変換と文字列接頭辞の追加が可能になります(デフォルトは ROLE_ です)。
導入:
3.1
  • コンストラクターの詳細

    • SimpleAuthorityMapper

      public SimpleAuthorityMapper()
  • メソッドの詳細

    • afterPropertiesSet

      public void afterPropertiesSet()
      次で指定:
      インターフェース org.springframework.beans.factory.InitializingBeanafterPropertiesSet 
    • mapAuthorities

      public SetSE<GrantedAuthority> mapAuthorities(CollectionSE<? extends GrantedAuthority> authorities)
      大文字と小文字の変換とプレフィックスの設定に基づいて、指定された権限のマッピングを作成します。変換中に重複が生成されない限り、マッピングは 1 対 1 になります。デフォルトの権限が設定されている場合、これも各マッピングに割り当てられます。
      次で指定:
      インターフェース GrantedAuthoritiesMappermapAuthorities 
      パラメーター:
      authorities - 元の権限
      戻り値:
      変換された一連の権限
    • setPrefix

      public void setPrefix(StringSE prefix)
      権限名に追加するプレフィックスを設定します (まだ存在しない場合)
      パラメーター:
      prefix - 通常、AccessDecisionVoter の動作を満たすためのプレフィックス。
    • setConvertToUpperCase

      public void setConvertToUpperCase(boolean convertToUpperCase)
      マッピングで権限値を大文字に変換するかどうか。
      パラメーター:
      convertToUpperCase - デフォルトは false
    • setConvertToLowerCase

      public void setConvertToLowerCase(boolean convertToLowerCase)
      マッピングで権限値を小文字に変換するかどうか。
      パラメーター:
      convertToLowerCase - デフォルトは false
    • setDefaultAuthority

      public void setDefaultAuthority(StringSE authority)
      すべてのユーザーに割り当てられるデフォルトの権限を設定します
      パラメーター:
      authority - すべてのユーザーに割り当てられる権限の名前。