[.net6 Cookie] CookieAuthenticationOptions > Web/Blazor

본문 바로가기
사이트 내 전체검색

Web/Blazor

[.net6 Cookie] CookieAuthenticationOptions

페이지 정보

작성자 sbLAB 댓글 0건 조회 267회 작성일 21-12-27 10:01

본문


 .Net6  Blazor WASM 


CookieAuthenticationOptions Class


https://docs.microsoft.com/ko-kr/dotnet/api/microsoft.aspnetcore.authentication.cookies.cookieauthenticationoptions?view=aspnetcore-6.0 



CookieAuthenticationOptions.ExpireTimeSpan   

https://docs.microsoft.com/ko-kr/dotnet/api/microsoft.aspnetcore.authentication.cookies.cookieauthenticationoptions.expiretimespan?view=aspnetcore-6.0 



CookieAuthenticationOptions.SlidingExpiration

https://docs.microsoft.com/ko-kr/dotnet/api/microsoft.aspnetcore.authentication.cookies.cookieauthenticationoptions.slidingexpiration?view=aspnetcore-6.0#Microsoft_AspNetCore_Authentication_Cookies_CookieAuthenticationOptions_SlidingExpiration 

* 쿠키 만료기간 재설정(만료기간의 반이 되었을 때부터 갱신동작, true / false)


Sample

https://stackoverflow.com/questions/67611267/how-to-stop-the-cookie-invalidation-after-each-time-a-blazor-piece-of-code-is-ch


options.Cookie.SameSite = SameSiteMode.Lax;

https://www.hahwul.com/2020/01/18/samesite-lax/ 



How IsPersistent works in Cookie authentication 

https://stackoverflow.com/questions/31946582/how-ispersistent-works-in-owin-cookie-authentication

=> Persistent cookies will be saved as files in the browser folders until they either expire or manually deleted. 

This will cause the cookie to persist even if you close the browser. 


■ If IsPersistent is set to false =>   the browser will acquire session cookie which gets cleared when the browser is closed. Now the reason session cookie wont clear after restarting the browser is because of chrome default settings. To fix it go to chrome settings -> advanced, and uncheck Continue running background apps when Google Chrome is closed under System section.


IsPersistent 는 브라우저 Closing될때 브라우저 폴더에 저장하여 쿠키를 삭제하지 않으므로 지속되는 것일 뿐이며, 

   ExpireTimeSpan 와 관련없다. 특정프로젝트에서 CookieAuthenticationOptions  -> ExpireTimeSpan 을 최대기간(3년이상) 설정.

 

댓글목록

등록된 댓글이 없습니다.

회원로그인

접속자집계

오늘
49
어제
59
최대
124
전체
45,515

그누보드5
Copyright © sebom.com All rights reserved.