2009-07-11 50 views
0

我對SSL非常陌生,想爲我的應用程序在GLASSFISH上安裝SSL,儘管試圖找到一些教程,可以從基礎教程中學習,但無法找到任何詳細的解決方案。 1)像如何爲SSL生成自簽名證書? 2)如何使用我的應用程序配置此證書? 3)如何在SSL上只配置登錄頁面? 4)什麼是openSSL,它如何在應用程序中使用?如何生成自簽名並配置SSL?

回答

0

對於問題3,這是可以做到這樣的:

  1. 創建一個名爲 「USERAUTH」 的指令在安全領域: http://docs.oracle.com/cd/E18930_01/html/821-2435/ggkuk.html

  2. 配置你的web.xml通過要求其具有CONFIDENTIAL(加密)屬性集來保護您的登錄頁面。例如:(登錄*或/登錄/ *)

    <security-constraint> 
        <display-name>ConstraintSSL</display-name> 
        <web-resource-collection> 
         <web-resource-name>protected</web-resource-name> 
         <description/> 
         <url-pattern>/login/*</url-pattern> 
         <url-pattern>/login.*</url-pattern> 
         <http-method>GET</http-method> 
         <http-method>POST</http-method> 
         <http-method>HEAD</http-method> 
         <http-method>PUT</http-method> 
         <http-method>OPTIONS</http-method> 
         <http-method>TRACE</http-method> 
         <http-method>DELETE</http-method> 
        </web-resource-collection> 
    
        <user-data-constraint>   
         <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
        </user-data-constraint>   
    </security-constraint> 
    
    
    <security-role> 
        <description/> 
        <role-name>USERS</role-name> 
    </security-role> 
    <security-role> 
        <description/> 
        <role-name>ADMINISTRATORS</role-name> 
    </security-role> 
    

與上述的配置,登錄頁面需要一個安全信道,在這種情況下HTTPS。因此,如果在您的glassfish服務器中正確配置,您的應用程序將自動重定向到SSL端口。