Custom Web API with Claims Security
I'm building a custom ASP.net web api in Sitefinity 9.1. I would like consumers to be able to use the same claims authentication they would against the built in Sitefinity web services --that is call sitefinity login endpoint, get a token and pass that claim token to my endpoint. I've built the api and am calling it via this test rest clent app published by Progress (github.com/.../RESTfulSitefinityClient). The test app does everything right --gets a token and passes it as a header to the API. The problem is, within the API itself, I can't seem to be able to get ahold of the actual user. I'm trying to get the user in the API by calling var identity = ClaimsManager.GetCurrentIdentity(); However, "Anonymous" is always returned. Any thoughts?
Hi Adam,
Did you ever resolve this? I'm having the same problem!
For anyone who runs into the same issue. You can resolve it by having your custom api use a different route. /api is used by Sitefinity by default. Switching your custom code to user a different route should solve the issue.