Spring Securityチュートリアル
Spring Securityは、SpringベースのJavaWebアプリケーションを保護するための柔軟で強力な認証およびアクセス制御フレームワークです。
このチュートリアルで使用するSpringバージョン:
-
Spring 3.2.8.RELEASE
-
Spring Security 3.2.3.RELEASE
Note
これを試してくださいSpring Boot + Spring Security + Thymeleaf example
1. Spring Securityの例
Spring SecurityでWebアプリケーションを保護する方法を示す例。
-
Spring Security Hello World XML Example
Spring MVC + Spring Security XMLベースのプロジェクト。デフォルトのログインフォームを使用します。 -
Spring Security Hello World Annotation Example
Spring MVC + Spring Securityアノテーションベースのプロジェクト。デフォルトのログインフォームを使用します。 -
Spring Security Custom Login Form XML Example
Spring MVC + Spring Security XMLベースのプロジェクト、カスタムログインフォーム、ログアウト機能、CSRF保護、メモリ内認証。 -
Spring Security Custom Login Form Annotation Example
Spring MVC + Spring Securityアノテーションベースのプロジェクト、カスタムログインフォーム、ログアウト機能、CSRF保護、メモリ内認証。 -
Spring Security Form Login Using Database – XML and Annotation Example
データベース認証、Spring Security、JSP taglibs、JDBCは、XMLと注釈の両方で403アクセス拒否ページなどをカスタマイズします。 -
Spring Security : Limit Login Attempts – XML and Annotation Example
ユーザーが3回の無効なログイン試行を試みた場合、ユーザーアカウントをロックします。 -
Spring Security Remember Me Example
「永続トークンアプローチ」の例を思い出してください。 Extra:Remember Me Cookieからのユーザーログインでは、更新操作を実行できません。 -
Spring Security password hashing example
BCryptアルゴリズムを使用したパスワードエンコーダ。 -
Spring Security + Hibernate XML Example
Hibernateを使用してデータベース認証のためにユーザーをロードします。 -
Spring Security + Hibernate Annotation Example
Hibernateを使用してデータベース認証のためにユーザーをロードします。
2. FAQs
Spring Securityでよく寄せられる質問。
-
Customize 403 access denied page
トピックと同様に、error-page属性とカスタムハンドラーを使用して、403アクセス拒否ページをカスタマイズする方法を示します。 -
Check if user is from remember me cookie
認証の場合== RememberMeAuthenticationToken -
Encoded password does not look like BCrypt
「パスワード」の長さがbcryptハッシュ値を格納するのに十分ではありません。 -
How to get current login username in Spring Security
SpringSecurityで現在のログインユーザー名を取得する3つの方法。 -
ClassNotFoundException:org.springframework.security.web.savedrequest.DefaultSavedRequest
一部の古い記事または廃止された記事は、将来更新される可能性があります。
-
Spring Security HTTP basic authentication example
ブラウザに認証用のログインダイアログが表示されます。 -
Spring Security access control example
Webアプリケーションにアクセス制御または承認を実装する例。 -
Display custom error message in Spring Security
デフォルトのSpringSecurityエラーメッセージを簡単に上書きする方法。 -
Spring Security logout example
ログアウト機能を実装する方法を示す簡単な例。