asp.net - How is the User property generated when authenticating with bearer tokens in Web Api? -
the documentation sparse in area, means can't find clear answer anywhere. if i'm not mistaken, when using cookie authentication in mvc app, cookie contains encrypted info decrypted , seeded principal on each request. same thing happening bearer tokens? token contain info goes principal? how work behind scenes? i'm sorry if dumb question, find current authentication/authorization implementation in asp.net mvc , web api confusing, , there not lot of documentation out there.
from understanding, pretty correct.
when authenticating user's credentials, extend oauthauthorizationserverprovider class overriding grantresourceownercredentials method; create claimsidentity instance , pass authenticationticket.
the claimsidentity (and assigned claims , data) encrypted , sent part of "access_token" section of response.
microsoft's owin authentication middleware looks after plumbing of encrypt/decrypt , serialization process. iis hosted scenarios encryption uses machinekey in machine.config. self host, owin falls data protection api
on blog, brock allen provides insight , explanation of microsoft's owin authentication middleware , going on behind scenes. read here , here further details
Comments
Post a Comment