クラス DefaultMethodSecurityExpressionHandler

  • 実装されたすべてのインターフェース:
    org.springframework.aop.framework.AopInfrastructureBeanorg.springframework.beans.factory.Awareorg.springframework.context.ApplicationContextAwareMethodSecurityExpressionHandlerSecurityExpressionHandler<org.aopalliance.intercept.MethodInvocation>

    public class DefaultMethodSecurityExpressionHandler
    extends AbstractSecurityExpressionHandler<org.aopalliance.intercept.MethodInvocation>
    implements MethodSecurityExpressionHandler
    MethodSecurityExpressionHandler の標準実装。

    通常、単一のインスタンスは、式のサポートを必要とする Bean 間で共有する必要があります。

    導入:
    3.0
    • フィールドの詳細

      • logger

        protected final org.apache.commons.logging.Log logger
    • コンストラクターの詳細

      • DefaultMethodSecurityExpressionHandler

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

      • createEvaluationContextInternal

        public org.springframework.expression.spel.support.StandardEvaluationContext createEvaluationContextInternal​(Authentication auth,
                                                                                                                     org.aopalliance.intercept.MethodInvocation mi)
        MethodSecurityEvaluationContext を EvaluationContext 実装として使用します。
        オーバーライド:
        クラス AbstractSecurityExpressionHandler<org.aopalliance.intercept.MethodInvocation>createEvaluationContextInternal 
        パラメーター:
        auth - 現在の認証オブジェクト
        mi - 呼び出し (フィルター、メソッド、チャネル)
        戻り値:
        StandardEvaluationContext またはオーバーライドされる可能性のあるカスタムサブクラス。
      • createSecurityExpressionRoot

        protected MethodSecurityExpressionOperations createSecurityExpressionRoot​(Authentication authentication,
                                                                                  org.aopalliance.intercept.MethodInvocation invocation)
        式評価用のルートオブジェクトを作成します。
        次で指定:
        クラス AbstractSecurityExpressionHandler<org.aopalliance.intercept.MethodInvocation>createSecurityExpressionRoot 
        パラメーター:
        authentication - 現在の認証オブジェクト
        invocation - 呼び出し (フィルター、メソッド、チャネル)
        戻り値:
        オブジェクト
      • filter

        public java.lang.Object filter​(java.lang.Object filterTarget,
                                       org.springframework.expression.Expression filterExpression,
                                       org.springframework.expression.EvaluationContext ctx)
        提供された式を評価することにより、filterTarget オブジェクト(コレクション、配列、マップ、ストリームのいずれかである必要があります)をフィルター処理します。

        Collection または Map が使用されている場合、元のインスタンスは、許可式が true と評価される要素を含むように変更されます。配列の場合、新しい配列インスタンスが返されます。

        次で指定:
        インターフェース MethodSecurityExpressionHandlerfilter 
        パラメーター:
        filterTarget - フィルタリングする配列またはコレクション。
        filterExpression - フィルター条件として使用される式。評価時に false を返す場合、オブジェクトは返されたコレクションから削除されます
        ctx - 現在の評価コンテキスト(SecurityExpressionHandler.createEvaluationContext(org.springframework.security.core.Authentication, Object) の呼び出しを通じて作成されたもの)
        戻り値:
        フィルタリングされたコレクションまたは配列
      • setParameterNameDiscoverer

        public void setParameterNameDiscoverer​(org.springframework.core.ParameterNameDiscoverer parameterNameDiscoverer)
        使用する ParameterNameDiscoverer を設定します。デフォルトは DefaultSecurityParameterNameDiscoverer です。
        パラメーター:
        parameterNameDiscoverer -
      • getParameterNameDiscoverer

        protected org.springframework.core.ParameterNameDiscoverer getParameterNameDiscoverer()
        戻り値:
        現在の ParameterNameDiscoverer
      • setPermissionCacheOptimizer

        public void setPermissionCacheOptimizer​(PermissionCacheOptimizer permissionCacheOptimizer)
      • setDefaultRolePrefix

        public void setDefaultRolePrefix​(java.lang.String defaultRolePrefix)

        SecurityExpressionRoot.hasAnyRole(String...) または SecurityExpressionRoot.hasRole(String) に追加するデフォルトのプレフィックスを設定します。例: hasRole("ADMIN" ) または hasRole("ROLE_ADMIN" ) が渡された場合、defaultRolePrefix が "ROLE_" (デフォルト) のときはロール ROLE_ADMIN が使用されます。

        null または空の場合、デフォルトのロールプレフィックスは使用されません。

        パラメーター:
        defaultRolePrefix - ロールに追加するデフォルトのプレフィックス。デフォルトは "ROLE_"。
      • getDefaultRolePrefix

        protected java.lang.String getDefaultRolePrefix()
        戻り値:
        デフォルトのロール接頭辞