Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static SharePointContextProvider()
}
else
{
if(HttpContext.Current.User.Identity.AuthenticationType == "Federation") {
if (HttpContext.Current.User.Identity.GetType() == typeof(ClaimsIdentity)) {
SharePointContextProvider.current = new SharePointHighTrustSamlContextProvider();
} else {
SharePointContextProvider.current = new SharePointHighTrustContextProvider();
Expand Down
16 changes: 13 additions & 3 deletions SharePointContextSaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ private static TokenHelper.ClaimsUserIdClaim RetrieveIdentityForSamlClaimsUser(C
return id;
}


/// <summary>
/// NOT IMPLEMENTED
/// </summary>
Expand Down Expand Up @@ -518,11 +518,11 @@ private static void RenewAccessTokenIfNeeded(ref Tuple<string, DateTime> accessT
/// </summary>
public class SharePointHighTrustSamlContextProvider : SharePointHighTrustContextProvider
{

private const string SPContextKey = "SPContext";
protected override SharePointContext CreateSharePointContext(Uri spHostUrl, Uri spAppWebUrl, string spLanguage, string spClientTag, string spProductNumber, HttpRequestBase httpRequest)
{
ClaimsIdentity logonUserIdentity = HttpContext.Current.User.Identity as ClaimsIdentity;
if (logonUserIdentity == null || !logonUserIdentity.IsAuthenticated )
if (logonUserIdentity == null || !logonUserIdentity.IsAuthenticated)
{
return null;
}
Expand All @@ -546,6 +546,16 @@ protected override bool ValidateSharePointContext(SharePointContext spContext, H

return false;
}

protected override SharePointContext LoadSharePointContext(HttpContextBase httpContext)
{
return httpContext.Session[SPContextKey] as SharePointHighTrustSamlContext;
}

protected override void SaveSharePointContext(SharePointContext spContext, HttpContextBase httpContext)
{
httpContext.Session[SPContextKey] = spContext as SharePointHighTrustSamlContext;
}
}

#endregion HighTrust
Expand Down