Skip to content

Instantly share code, notes, and snippets.

@brentschmaltz
Last active April 30, 2016 22:41
Show Gist options
  • Save brentschmaltz/7581eeabcec4d65d8a41 to your computer and use it in GitHub Desktop.
Save brentschmaltz/7581eeabcec4d65d8a41 to your computer and use it in GitHub Desktop.
// startup.auth.cs
{ ….
var openIdConnectAuthenticationOptions =
new OpenIdConnectAuthenticationOptions
{
Authentication Type = OpenIdConnectAuthenticationDefaults.AuthenticationType,
Authority = authority,
ClientId = client ID,
Notifications =
new OpenIdConnectAuthenticationNotifications
{
AuthorizationCodeReceived = AuthorizationCodeReceived,
AuthenticationFailed = AuthenticationFailed,
MessageReceived = MessageReceived,
 
// 'parameter=value', will be added to the query string.
RedirectToIdentityProvider = (notification) =>
{
notification.ProtocolMessage.Parameters["parameter"] = "value";
return Task.FromResult(0);
},
SecurityTokenReceived = SecurityTokenReceived,
SecurityTokenValidated = SecurityTokenValidated,
},
};
 
app.UseOpenIdConnectAuthentication(openIdConnectAuthenticationOptions);
….}
public static Task AuthorizationCodeReceived(AuthorizationCodeReceivedNotification notification)
{
return Task.FromResult<object>(null);
}
public static Task Authentication Failed(AuthenticationFailedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification)
{
return Task.FromResult<object>(null);
}
public static Task MessageReceived(MessageReceivedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification)
{
return Task.FromResult<object>(null);
}
 
public static Task SecurityTokenReceived(SecurityTokenReceivedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification)
{
return Task.FromResult<object>(null);
}
 
public static Task SecurityTokenValidated(SecurityTokenValidatedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification)
{
return Task.FromResult<object>(null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment