MarimerLLC / cslaforum

Discussion forum for CSLA .NET
https://cslanet.com
Other
31 stars 6 forks source link

How implement IMobileObject for ClaimsIdentity #317

Open sylum opened 7 years ago

sylum commented 7 years ago

Hi Folks,

I'm currently working on n tiers MCV5 + CSLA 4.6.1 application using the dataportal with MobileProxy. I'm facing somes diffuciltes with the authentication, cause the ClaimsIdentity needs to implement IMobileObject. Does anyone have already do this kind of implementation ?

thanks for your helps,

Cedric

rockfordlhotka commented 7 years ago

Where are you attempting to serialize the ClaimsIdentity? Between web and app server, or out to a mobile client device?

sylum commented 7 years ago

Hi Rocky,

I'm attempting to serialize the ClaimsIdentity between web and app server. Both of them will be hosted on Azure (webApp container).

rockfordlhotka commented 7 years ago

I don't know if ClaimsIdentity is marked as Serializable - as in whether Microsoft allows it to serialize using BinaryFormatter or NDCS. If it is serializable using those technologies (and you aren't planning to ever use .NET Core) then there are some options in that regard.

Otherwise you'll need to do one of the following:

  1. Create your own principal/identity classes that contain the data from ClaimsIdentity, allowing that information to flow over the network.
  2. Flow key values necessary to rehydrate the ClaimsPrincipal on each server as the request arrives at that server

The first option basically bypasses any sort of distributed security provided by your network infrastructure. The second option leverages any sort of distributed security provided by your network infrastructure.

rockfordlhotka commented 7 years ago

fwiw, the issue here is pretty much the same as with a WindowsIdentity (also not serializable). Either you get the underlying network to support impersonation and pass keys through the data portal so you can reauthenticate on each machine, or you pull the relevant data out of the identity into your identity and pass that around through the data portal.

sylum commented 7 years ago

Thank you very much for your good advices. You give me enough matter to pursue my investigations. I think i will dig up the solution 1.