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

Create token for Windows Identity on custom forms login page

$
0
0

We've created a custom forms login page that successfully authenticates fba users.

The problem is that windows users who are already logged into the network and sitting at their desks will access the site using their domain credentials.  I don't want them to pick between logging in as forms users or as windows user.

How can I programmatically create a token from a Windows Identity.  For a forms user it's done this way:

SecurityToken token = SPSecurityContext.SecurityTokenForFormsAuthentication(new Uri(SPContext.Current.Web.Url), "Ext", "ExtRole", userName, password);
SPFederationAuthenticationModule.Current.SetPrincipalAndWriteSessionToken(token);

I assume it would require a call to the security token service using the identity of the logged in windows user. 

SecurityToken token =  getTokenFromSTS();
SPFederationAuthenticationModule.Current.SetPrincipalAndWriteSessionToken(token);

Thoughts?

Thanks


Nate


Viewing all articles
Browse latest Browse all 7589

Trending Articles



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