Skip to content

Instantly share code, notes, and snippets.

@pksorensen
Created March 6, 2014 02:48
Show Gist options
  • Save pksorensen/9381304 to your computer and use it in GitHub Desktop.
Save pksorensen/9381304 to your computer and use it in GitHub Desktop.
a.ProtocolMessage.IssuerAddress = "https://login.windows.net/common/wsfed";
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = WsFederationAuthenticationDefaults.AuthenticationType,
});
app.UseWsFederationAuthentication(new WsFederationAuthenticationOptions
{
TokenValidationParameters = new System.IdentityModel.Tokens.TokenValidationParameters
{
// I will update this demo as more information is avalibe.
//ValidateIssuer = false -> this causes IssuereValidator to not be run.
//UPDATE Bug has been confirmed that this is not working as intented.
//UPDATE2 This works when a 3th party organizational user signs in, if returning false the user will not be signed in
//but it gives a YSOD right now instead of a user friendly error.
IssuerValidator = (issuer, token) =>
{
return true;
return false; // it still sign in the user even though its false.
// return DatabaseIssuerNameRegistry.ContainsTenant(issuer);
}
},
IssuerAddress = "https://login.windows.net/common/",
Wtrealm = "https://demo009.s-innovations.net",
Wreply = "https://localhost:44309/",
MetadataAddress = "https://login.windows.net/802626c6-0f5c-4293-a8f5-198ecd481fe3/FederationMetadata/2007-06/FederationMetadata.xml",
Notifications = new WsFederationAuthenticationNotifications
{
AuthenticationFailed = async (a) =>
{ },
MessageReceived = async (a) =>
{ },
RedirectToIdentityProvider = async (a) =>
{
// a.ProtocolMessage.SetParameter("site_id", "501358"); //this is the oauth site id for mail discovery
a.ProtocolMessage.IssuerAddress = "https://login.windows.net/common/wsfed";
a.ProtocolMessage.Parameters.Add("id", "500879");
},
SecurityTokenReceived = async (a) =>
{ }
,
SecurityTokenValidated = async (a) =>
{ }
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment