我有一個使用http託管的現有Web應用程序。
對於某些部分,我強制用戶使用Google(OAuth)登錄並收穫他們的電子郵件ID。
我然後設置cookie 6個月,並設置其內容作爲它由兩個變量的編碼字符串 - X &Ž基於oauth的身份驗證查詢
String x = new BigInteger(130, random).toString(32);
String z = new BigInteger(130, random).toString(32);
String cookieValue = URLEncoder.encode("z="+z+"&x="+x, "UTF-8");
Cookie cookie = new Cookie("someDomain",cookieValue);
cookie.setHttpOnly(true);
cookie.setPath("/");
cookie.setMaxAge(6 Months);`
這些相同的值「x」和「z」的隨後被存儲在使用者的記錄在數據庫中以及用戶的每次訪問 - 這些值在cookie中和數據庫中都會更改。
您是否發現此方法中存在任何安全問題?
首先使用https。 –