2014-01-17 82 views
0

我目前正在開發一個運行在apache tomcat 7服務器上的webbapps。在這個Web應用程序中,我需要檢查用於登錄應用程序的登錄是否與當前的Windows會話登錄相同,以便只有計算機的所有者才能在他的計算機中使用該應用程序。 我試圖做這樣的事情:如何從webapps java獲取windows會話登錄?

靜態布爾鑑別的(字符串username){

boolean isAuth = false; 

try { 
    /* 
    * verify if the user logged in windows is equal to the user who try 
    * top connect System.getProperty("user.name") return the windows 
    * session login 
    */ 

    if (username.equals(System.getProperty("user.name"))) { 

    isAuth = true; 
    } 

    System.out.println("return : " + isAuth + "\r\n"); 
} catch (Exception ex) { 
    logger = AuthenticationImpl.initLog(); 
    logger.log(Level.SEVERE, ex.getMessage()); 
    fh.close(); 
} 

return isAuth; 

} 

但由於在服務器System.getProperty(「user.name」)我的Web應用運行不再retruning Windows會話登錄。

任何人都知道如何通過會話登錄到服務器的窗口?

回答