After doing some research into this, I have a possible solution to determine ADFS authentication, but I have no way to test this.
Here's the idea (point by point):
1) There is a class called System.Web.Security.SingleSignOn.SingleSignOnIdentity. SingleSignOnIdentity Class - MSDN
2) In Testing Whether ADFS User Is Authenticated they cast the user identity to the SingleSignOnIdentity object to test user authentication in ADFS. Which led me to the idea of "What happens if it isn't an SSO identity and you attempt to cast?"
3) And with that idea I found a couple posts that say that if a user's identity is not an SSO identity, an InvalidCastException will be thrown:
ADFS Identity Single Sign On Identity
ADFS System.Web.Security.SingleSignOn.SingleSignOnIdentity
4) So the C# would look something like:
bool isADFS;
try
{
SingleSignOnIdentity tryADFS = (SingleSignOnIdentity)User.Identity;
isADFS = true;
}
catch (InvalidCastException) // Not ADFS
{
isADFS = false;
}
Or perhaps:
bool isADFS = false;
if (User.Identity is SingleSignOnIdentity)
isADFS = true;
Like I said, I have no way to test it, but I think that should work. Let me know.
AuthenticationMode.WindowsusingSPSecurity.AuthenticationModewhich is the OM property for this. Have you looked into accessing the cookies? I'm not even sure if they'd contain the right information for you... – rjcup3 Oct 31 '12 at 16:54