24 Kasım 2020 Salı

SpringSecurity RememberMeServices

RememberMeServices Nedir?
RememberMeServices ben bir kere login olduktan sonra, artık tekrar login sayfasına uğramadan, doğrudan kullanmak istediğim sayfaya gidebilmemi sağlar.

Nasıl Etkinleştirilir
RememberMeServices hizmetine Login formunda karar verilir. Login formunda remember-me checkbox işaretli ise, kullanıcı tarayıcısını kapattıktan sonra bile tekrar login olmadan uygulamaya giriş yapabilmesini sağlar. Açıklaması şöyle.
When you check the "Remember Me" checkbox at the Portal Login page, your login will be remember for some days, even after you close your browser. The next time you open the same browser within that time period, you will be automatically logged in.
RememberMeServices Persistent Cookie Kullanılır
Açıklaması şöyle. Persistent Cookie içinde kullanıcı ismi vardır. 
The "remember me" functionality tells the server that you want to use a persistent cookie for your login so that it is remembered for a longer period of time.  When the server sees this checkbox, it sends back a persistent cookie rather than a session cookie.
HTML formundaki check box için şöyle yaparız.
<input type="checkbox" name="remember-me" />
Session Cookie ve Persistent Cookie Farkı Nedir?
Açıklaması şöyle. Aslında ikisinin arasındaki tek fark, birisine expiration date değerinin atanması
There are two different types of cookies - session cookies and persistent cookies. If a cookie does not contain an expiration date, it is considered a session cookie. Session cookies are stored in memory and never written to disk. When the browser closes, the cookie is permanently lost from this point on. If the cookie contains an expiration date, it is considered a persistent cookie. On the date specified in the expiration, the cookie will be removed from the disk.
JSESSIONID Cookie Expiration Date
Tüm bilgiler bellekte tutuluyorsa ve eğer JSESSIONID Cookie Expiration Date değeri remember-me Cookie Expiration Date değerinden büyükse, zaten RememberMeServices hizmetini kullanmaya gerek olmayabilir. Çünkü kullanıcı oturumu zaten kapanmıyor. RememberMeServices ancak JSESSIONID Cookie elle falan silinirse işe yarar.

Hiç yorum yok:

Yorum Gönder