登入認證驗證

來源:互聯網
上載者:User
需求:
為了提高安全性.
某人擁有某個認證,才能進行登入.

環境:
Tomcat

設計:
採用SSL,https登入.
伺服器驗證認證.(貌似SSL裡面自己做了驗證)
讀取認證資訊,檢查是否該對應登入人員.
   
實現:
1.下載openssl
編譯好的openssl下載:
http://www.slproweb.com/products/Win32OpenSSL.html

2.產生認證:
參考文章http://www.ibm.com/developerworks/cn/security/se-tcssl/index.html
產生3個認證:CA認證,伺服器憑證,用戶端認證.

3.修改tomcat的server.xml檔案

4.在servlet裡面讀取
boolean isSecure = request.isSecure();

String certAttribute = "javax.servlet.request.X509Certificate";
X509Certificate[] certificate =
(X509Certificate[]) request.getAttribute(certAttribute);

5.添加認證:
參考文章http://www.ibm.com/developerworks/cn/security/se-tcssl/index.html
產生用戶端認證.
在另一個用戶端安裝,用戶端就可以正常訪問了.

要點:
1.產生CA,伺服器,用戶端認證.
很混亂的關係.

問題:
1.serlet擷取認證對象,
java.security.cert.X509Certificate certs = (java.security.cert.X509Certificate) request.getAttribute("javax.servlet.request.X509Certificate");
提示java.lang.ClassCastException: [Ljava.security.cert.X509Certificate
得到的數組,改成如下:
java.security.cert.X509Certificate[] certs = (java.security.cert.X509Certificate[]) request.getAttribute("javax.servlet.request.X509Certificate");

2.keytool常用命令
keytool -genkey 組建檔案

改進:
1.都是手工產生用戶端,怎麼自動產生用戶端認證.
2.SSL與JSSE的關係.
JSSE(JAVA Secure Socket Extension)
SSL (Secure Socket Layer)
JSSE provides a framework and an implementation for a Java language version of the SSL and TLS protocols.
3.IE可能匯入自訂認證出問題.
4.關於密碼
5.認證到期

參考文章:
配置Tomcat 4使用SSL
http://www.ibm.com/developerworks/cn/security/se-tcssl/index.html

tomcat實現SSL配置!(雙向)
http://www.dedecms.com/web-art/fuwuqi/20060913/26272.html

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.