Otis wrote:
mikeg22 wrote:
Ok. Is there a way to configure it so that the DI runs when the deserialization constructor runs? And if yes (I'm guessing no
) can it just run on one side of the remoting boundary, on the client side when an entity comes from the server?
My situation is that it only makes sense to use authorization on the client. On the server, security can be disregarded as there are plenty of entity-related functions which are user-ambigious. I suppose the authorizer can check its environment and only do anything if it is on the client, but this seems like a bit of a hack.
On the contrary, I think it's the best solution.
The thing is: authorization is context bound, so you have to figure out the context in which you are doing authorization anyway. So if you're on the server, the authorization can be necessary sometimes (not now, but perhaps in the future) and in other situations it's not.
So you have to obtain the list of credentials per user anyway. And guess what: on the server that's a full list: everyone is allowed to do everything
.
I had pretty much convinced myself that the context should be deciding when to use the authorization, but I admit I don't exactly know why
I guess I'm a big fan of keeping the decisions in the context itself, which is why I like the adapter model to begin with...there is no "magic black box code" running inside the entity deciding how to persist itself...its all there for you to see in the context.
Another reason I wanted the authorizer to just "not be there" on the server is that I don't want to set up default answers that come out of the dummy authorizer when it is running on the server. All the "Can..." functions on the dummy authorizer will have to return "true" I guess, but I would prefer the code path not even have to come to these hard-coded decisions. This is because I see the situation not as "what are the credentials per user on the server" but more that "there is no authorization on the server."
Oh well, I'll figure something out. Thanks for your help