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?

有帮助吗?

解决方案

You need to check if the username is encoded.

SPClaimProviderManager.IsEncodedClaim(SPContext.Current.Web.CurrentUser.LoginName)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top