Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

What purpose TicketDataFormat used for

$
0
0

just got the code from here http://stackoverflow.com/a/21740549/6188148

as far as i know auth cookie content is encrypted by asp.net engine. below code try to use his encryption and decryption logic to encrypted cookie content ?

please tell me what the below code try to do ?

app.UseCookieAuthentication(newCookieAuthenticationOptions(){TicketDataFormat=newMyCustomSecureDataFormat()});publicclassMyCustomSecureDataFormat:ISecureDataFormat{privatestaticAuthenticationTicket savedTicket;publicstringProtect(AuthenticationTicket ticket){//Ticket value serialized here will be the cookie sent. Encryption stage.//Make any changes if you wish to the ticket
         ticket.Identity.AddClaim(newClaim("Myprotectionmethod","true"));returnMySerializeAndEncryptedStringMethod(ticket);}publicAuthenticationTicketUnprotect(string cookieValue){//Invoked everytime when a cookie string is being converted to a AuthenticationTicket.returnMyDecryptAndDeserializeStringMethod(cookieValue);}}

Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>