Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

How to programatically authenticate user to Active Directory to get SharePoint 2013 Windows Claim

$
0
0

Hi.

The problem: 

See code below;

the ensureuser command is working fine, in the sense that the user will actually have the correct right in SharePoint as a valid user which can log on (as far as I have inspected the access tables in SharePoint's sql database).

But after the "web.Update();" statement, which statements will autenticate user with AD programmatically, so that the user will be logged in to SharePoint with a SharePoint windows claim?

--------------

SPSecurity.RunWithElevatedPrivileges(() => { { using (SPSite site = SPContext.Current.Site) { using (SPWeb web = site.OpenWeb()) { web.AllowUnsafeUpdates = true; web.EnsureUser(String.Format("{0}\\{1}", domainName, accountName)); web.Update(); } } } });

-----------------

Background information (not important):

Because of integration with the Microsoft BI-stack's OLAP cubes, our implementation require that I create users from external logon provider into local Active Directory, and then authenticate Sharepoint to this newly created account in order to get a Windows claim. (The process needs to run aa an unautehenticated user up until authorization With AD.)

When the user access reports as an authenticated user, the cube logic need a Windows Principal attached in order to have the  cube's internal security dimension working, and here the Claims to Windows Token service (c2WTS) will intercept and attach this by a lookup to Active Directory using the UPN in the Claim.

Best regards



Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>