Index ソフト・ハード | Spring タスク |
機能・要件 構成・方式 タスク SpringSec 3→4 UploadFile 405err web.xml |
Spring Security( 3.2 → 4.1 ) ・参考 ・ログイン関連 ・spring-security.xml、login.jsp 関連 ・j_spring_security_check→login ・j_username→username ・j_password→password ・login?error→?error ・j_spring_security_logout→/logout・CSRFチェック関連 ・jsp(ログインフォーム) <nput type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/> ・jsp(ログアウトする場合(セッション破棄)) <form id="logoutForm" action="${logoutUrl}" method="POST"> <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/> <a href="javascript:void(0)" onclick="FormSubmit();">ログアウト</a> ・spring-security.xml
<sec:custom-filter ref="csrfFilter" before="LOGOUT_FILTER" />
<sec:session-management session-authentication-strategy-ref="sessionAuthenticationStrategy" />
<bean id="csrfTokenRepository"
class="org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository" />
<bean id="csrfFilter" class="org.springframework.security.web.csrf.CsrfFilter">
<constructor-arg index="0" ref="csrfTokenRepository" />
<property name="accessDeniedHandler">
<bean class="org.springframework.security.web.access.AccessDeniedHandlerImpl">
<property name="errorPage" value="/WEB-INF/views/common/error/csrfTokenError.jsp" />
</bean>
</property>
</bean>
<bean id="sessionAuthenticationStrategy"
class="org.springframework.security.web.authentication.session.CompositeSessionAuthenticationStrategy">
<constructor-arg index="0">
<list>
<bean class="org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy" />
<bean class="org.springframework.security.web.csrf.CsrfAuthenticationStrategy">
<constructor-arg index="0" ref="csrfTokenRepository" />
</bean>
</list>
</constructor-arg>
</bean>
Spring MVC upload file - HTTP Status 405 - Request method 'POST' not supported エラー対応 <form:form method="post" action="xxxx?${_csrf.parameterName}=${_csrf.token}" modelAttribute="xxxx" enctype="multipart/form-data"> web.xml ・web.xmlファイル(デプロイメント・ディスクリプタ)のスキーマを指定する2つの方法 DTD : ドキュメントタイプの定義 XSD : XMLスキーマの定義 XSDバージョンは、JSP 2.0/Servlets 2.4よりも優先される。・参考 ・Servlet3.1参考 |
All Rights Reserved. Copyright (C) ITCL |