クラス ChannelProcessingFilter
java.lang.ObjectSE
org.springframework.web.filter.GenericFilterBean
org.springframework.security.web.access.channel.ChannelProcessingFilter
- 実装されたすべてのインターフェース:
jakarta.servlet.Filter
、org.springframework.beans.factory.Aware
、org.springframework.beans.factory.BeanNameAware
、org.springframework.beans.factory.DisposableBean
、org.springframework.beans.factory.InitializingBean
、org.springframework.context.EnvironmentAware
、org.springframework.core.env.EnvironmentCapable
、org.springframework.web.context.ServletContextAware
public class ChannelProcessingFilter
extends org.springframework.web.filter.GenericFilterBean
Web リクエストが必要なチャネルを介して確実に配信されるようにします。
内部的に FilterInvocation
を使用してリクエストを表し、FilterInvocationSecurityMetadataSource
を使用して適用される属性を検索できるようにします。
実際のチャネルセキュリティの決定と必要なアクションを構成済みの ChannelDecisionManager
に委譲します。レスポンスが ChannelDecisionManager
によってコミットされた場合、フィルターチェーンは続行されません。
最も一般的な使用箇所は、リクエストが HTTPS を介して行われるようにすることです。この場合、ChannelDecisionManagerImpl
は SecureChannelProcessor
および InsecureChannelProcessor
で構成されます。典型的な構成は
<bean id="channelProcessingFilter" class="org.springframework.security.web.access.channel.ChannelProcessingFilter"> <property name="channelDecisionManager" ref="channelDecisionManager"/> <property name="securityMetadataSource"> <security:filter-security-metadata-source request-matcher="regex"> <security:intercept-url pattern="\A/secure/.*\Z" access="REQUIRES_SECURE_CHANNEL"/> <security:intercept-url pattern="\A/login.jsp.*\Z" access="REQUIRES_SECURE_CHANNEL"/> <security:intercept-url pattern="\A/.*\Z" access="ANY_CHANNEL"/> </security:filter-security-metadata-source> </property> </bean> <bean id="channelDecisionManager" class="org.springframework.security.web.access.channel.ChannelDecisionManagerImpl"> <property name="channelProcessors"> <list> <ref bean="secureChannelProcessor"/> <ref bean="insecureChannelProcessor"/> </list> </property> </bean> <bean id="secureChannelProcessor" class="org.springframework.security.web.access.channel.SecureChannelProcessor"/> <bean id="insecureChannelProcessor" class="org.springframework.security.web.access.channel.InsecureChannelProcessor"/>これにより、ログインフォームと
/secure
パスへのアクセスはすべて HTTPS 経由で行われます。フィールドサマリー
クラス org.springframework.web.filter.GenericFilterBean から継承されたフィールド
logger
コンストラクターのサマリー
コンストラクターメソッドのサマリー
修飾子と型メソッド説明void
void
doFilter
(jakarta.servlet.ServletRequest req, jakarta.servlet.ServletResponse res, jakarta.servlet.FilterChain chain) protected ChannelDecisionManager
protected FilterInvocationSecurityMetadataSource
void
setChannelDecisionManager
(ChannelDecisionManager channelDecisionManager) void
setSecurityMetadataSource
(FilterInvocationSecurityMetadataSource filterInvocationSecurityMetadataSource) クラス org.springframework.web.filter.GenericFilterBean から継承されたメソッド
addRequiredProperty, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
コンストラクターの詳細
ChannelProcessingFilter
public ChannelProcessingFilter()
メソッドの詳細
afterPropertiesSet
public void afterPropertiesSet()- 次で指定:
- インターフェース
org.springframework.beans.factory.InitializingBean
のafterPropertiesSet
- オーバーライド:
- クラス
org.springframework.web.filter.GenericFilterBean
のafterPropertiesSet
doFilter
public void doFilter(jakarta.servlet.ServletRequest req, jakarta.servlet.ServletResponse res, jakarta.servlet.FilterChain chain) throws IOExceptionSE, jakarta.servlet.ServletException - 例外:
IOExceptionSE
jakarta.servlet.ServletException
getChannelDecisionManager
getSecurityMetadataSource
setChannelDecisionManager
setSecurityMetadataSource
public void setSecurityMetadataSource(FilterInvocationSecurityMetadataSource filterInvocationSecurityMetadataSource)