/// <summary> /// Authenticate users using Auth0 /// </summary> /// <param name="app">The <see cref="IAppBuilder"/> passed to the configuration method</param> /// <param name="clientId">The client ID assigned by Auth0</param> /// <param name="clientSecret">The client secret assigned by Auth0</param> /// <param name="domain"></param> /// <param name="externalLoginCallback"></param> /// <param name="connection"></param> /// <param name="displayName"></param> /// <param name="saveIdToken"></param> /// <param name="scopes"></param> /// <param name="provider"></param> /// <returns>The updated <see cref="IAppBuilder"/></returns> public static IAppBuilder UseAuth0Authentication( this IAppBuilder app, string clientId, string clientSecret, string domain, string redirectPath = "/Auth0Account/ExternalLoginCallback", string displayName = "Auth0", string connection = null, bool saveIdToken = true, string scopes = "openid", IAuth0AuthenticationProvider provider = null, bool saveRefreshToken = false) { return UseAuth0Authentication( app, new Auth0AuthenticationOptions { ClientId = clientId, ClientSecret = clientSecret, Domain = domain, RedirectPath = new PathString(redirectPath), Caption = displayName, Connection = connection, AuthenticationType = string.IsNullOrEmpty(connection) ? Constants.DefaultAuthenticationType : connection, SaveIdToken = saveIdToken, Scope = scopes.Split(' '), Provider = provider, SaveRefreshToken = saveRefreshToken }); }
/// <summary> /// Authenticate users using Auth0 /// </summary> /// <param name="app">The <see cref="IAppBuilder"/> passed to the configuration method</param> /// <param name="clientId">The client ID assigned by Auth0</param> /// <param name="clientSecret">The client secret assigned by Auth0</param> /// <param name="domain"></param> /// <param name="externalLoginCallback"></param> /// <param name="connection"></param> /// <param name="displayName"></param> /// <param name="saveIdToken"></param> /// <param name="scopes"></param> /// <param name="provider"></param> /// <returns>The updated <see cref="IAppBuilder"/></returns> public static IAppBuilder UseAuth0Authentication( this IAppBuilder app, string clientId, string clientSecret, string domain, string redirectPath = "/", string displayName = "Auth0", string connection = null, bool saveIdToken = true, string scopes = "openid", IAuth0AuthenticationProvider provider = null, bool saveRefreshToken = false, string errorRedirectPath = "/") { return(UseAuth0Authentication( app, new Auth0AuthenticationOptions { ClientId = clientId, ClientSecret = clientSecret, Domain = domain, RedirectPath = new PathString(redirectPath), ErrorRedirectPath = new PathString(errorRedirectPath), Caption = displayName, Connection = connection, AuthenticationType = string.IsNullOrEmpty(connection) ? Constants.DefaultAuthenticationType : connection, SaveIdToken = saveIdToken, Scope = scopes.Split(' '), Provider = provider, SaveRefreshToken = saveRefreshToken })); }
public static IAppBuilder AddAuth0Authentication( this IAppBuilder app, string clientId, string clientSecret, string domain, string connection, string displayName, bool saveIdToken = true, string scopes = "openid", IAuth0AuthenticationProvider provider = null) { app.Use(typeof(Auth0AuthenticationMiddleware), app, new Auth0AuthenticationOptions { ClientId = clientId, ClientSecret = clientSecret, Domain = domain, Caption = displayName, Connection = connection, AuthenticationType = connection, SaveIdToken = saveIdToken, Scopes = scopes.Split(' '), SignInAsAuthenticationType = app.GetDefaultSignInAsAuthenticationType(), Provider = provider }); return app; }