Question

I've created few webparts in Sharepoint 2010. In current version users are authenticated by Ad login, but now custome want to customize it and allow authentication by AD login or by email name - using Claims (on different application pools).

My problem is that I have to check if user is authenticated by claims or not (to use this in my admin webpart).
I know that I can check user login name in sharepoint and if it is in this form: i:0#.f|ldapmember|user@example.com it means that I have Claims turned on.

But maybe there is better way to check if Claims is turned on? Does anyone know that method?

Was it helpful?

Solution

You need to check if the username is encoded.

SPClaimProviderManager.IsEncodedClaim(SPContext.Current.Web.CurrentUser.LoginName)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top