[.net6 Cookie] CookieAuthenticationOptions > C#/.Net/Blazor/IIS

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

C#/.Net/Blazor/IIS

[.net6 Cookie] CookieAuthenticationOptions

페이지 정보

작성자 sbLAB 댓글 0건 조회 4,964회 작성일 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년이상) 설정.

 

[이 게시물은 sbLAB님에 의해 2022-12-22 09:41:18 Web/PHP/API에서 이동 됨]

댓글목록

등록된 댓글이 없습니다.

회원로그인

접속자집계

오늘
167
어제
308
최대
1,279
전체
217,434

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