Authenticated WCF: Getting the Current Security Context
Posted
by bradhe
on Stack Overflow
See other posts from Stack Overflow
or by bradhe
Published on 2010-04-14T18:21:31Z
Indexed on
2010/04/14
18:23 UTC
Read the original article
Hit count: 373
I have the following scenario:
- I have various user's data stored in my database.
- This data was entered via a web app.
- We'd like to expose this data back to the user over a web service so that they can integrate their data with their applications.
- We would also like to expose some business logic over these services. As such we do not want to use OData.
- This is a multi-tenant application so I only want to expose their data back to them and not other users. Likewise, the business logic we expose should be relative to the authenticated user.
I would like let the user use an OASIS scheme to authenticate with the web service -- WCF already allows for this out of the box as far as I understand -- or perhaps we can issue them certificates to authenticate with. That bit hasn't really been worked out yet.
Here is a bit of pseudo-code of how I envision this would work within the service:
function GetUsersData(id)
var user := Lookup User based on Username from Auth Context
var data := Get Data From Repository based on "user"
return data
end function
For the business logic scenario I think it would look something like this:
function PerformBusinessLogic(someData)
var user := Lookup User based on Username from Auth Context
var returnValue := Perform some logic based on supplied data
return returnValue
end function
The hard bit here is getting the current username (or cert info in the cert scenario) that the user authenticated with!
Does WCF even enable this scenario? If not would WSE3 enable this?
Thanks,
© Stack Overflow or respective owner