How to Write Code Compatible with the Security Architectures of both SharePoint 2010 and 2007?
I'm currently reworking some code written for a SharePoint 2010 application, utilising Claims-based Authentication. However, I'm not that familiar with CBA and need to make the code work within a SharePoint 2007 and I'm banning my head against various invalid Google searches.
The code, creates a SecurityToken from within the SPSecurityContext, w开发者_如何学运维hich is only available, from what I can gather, in SP2010:
SPFormsAuthenticationProvider authProvider = iisSettings.FormsClaimsAuthenticationProvider;
return SPSecurityContext.SecurityTokenForFormsAuthentication(.....);
SPIisSettings in SP2007 does not contain any reference to FormsAuthentication, is there any other way that I can get this to work? I'd appreciate any feedback on this, like I said, I'm bumping my head against Google searches that's not getting me anywhere closer.
Edit: Thanks John for fixing up the question. Reads easier.
This is not possible in SharePoint 2007 as there's no claims token to authenticate against. What I'm trying to achieve here, after I actually sat down to understand the code, is to check whether a user's active session is valid, by interrogating the SecurityTokenService (Windows Identity Foundation). In standard Forms-based Authentication, this is not necessary.
Thanks,
Eric
精彩评论