第一步:導包
<第二部:編寫配置檔案dependency
>
<
groupid
>org.springframework.security
groupid
>
<
artifactid
>spring-security-web
artifactid
>
dependency
>
<
dependency
>
<
groupid
>org.springframework.security
groupid
>
<
artifactid
>spring-security-config
artifactid
>
dependency
>
第三步:將配置檔案載入,在web.xml中配置;
<第四部:編寫認證類context-param
>
<
param-name
>contextconfiglocation
param-name
>
<
param-value
>classpath:/spring/spring-security.xml
param-value
>
context-param
>
<
listener
>
<
listener-class
>
org.springframework.web.context.contextloaderlistener
listener-class
>
listener
>
<
filter
>
<
filter-name
>springsecurityfilterchain
filter-name
>
<
filter-class
>org.springframework.web.filter.delegatingfilterproxy
filter-class
>
filter
>
<
>
<
filter-name
>springsecurityfilterchain
filter-name
>
<
url-pattern
>/*
url-pattern
>
>
public class userdetailserviceimpl implements userdetailsservice執行流程: @override
public userdetails loaduserbyusername(string username) throws usernamenotfoundexception else
}return null;}}
客戶端傳送登陸請求,過濾器的處理進進入到指定的認證類,認證類從根據傳過來的使用者名稱,去資料庫中找資料,如果有會返回賬號和密碼,框架自己比較資料庫中的賬號密碼和輸入的賬號密碼,如一致則登陸成功,不一致則跳到指定的失敗頁面
總結:1.csrf disabled="true" 關閉csrf ,如果不加會出現錯誤
csrf(cross-site request forgery)跨站請求偽造,也被稱為「one click attack」或者session riding,通常縮寫為csrf或者xsrf,是一種對**的惡意利用。
2.security="none" 設定此資源不被攔截.
如果你沒有設定登入頁security="none" ,將會出現以下錯誤
因為登入頁會被反覆重定向。
3.在string security中獲得登陸名字可以使用
public class logincontroller}
mongodb els memcached安全漏洞
elasticsearch漏洞 漏洞 cve 2014 3120 命令執行 cve 2015 3337 目錄穿越 cve 2014 3120 命令執行 啟動 docker compose build docker compose up d cve 2015 3337 目錄穿越 在安裝了具有 site...
pureftp mysql pureftp安裝部署
ftp 檔案傳輸 pure ftpd ftp軟體 作用 通過對映登入傳送和接收檔案。wget 2 解壓包 tar jxvf pure ftpd 1.0.43.tar.bz2 3 進入解壓目錄 cd pure ftpd.4 初始化安裝環境 先建立安裝目錄mkdir usr local pureftpd...
thinkphp nginx phpcgj安裝配置
環境 mysql 5.6.26 nginx 1.9.4.tar.gz php 5.6.13 程式框架thinkphp 客戶要求必須使用nginx php 1.首先安裝nginx mysql php 2.安裝擴充套件php擴充套件 pdo mysql 1 cd usr local src php 5....