public TenantMiddleware( RequestDelegate next, IAuthenticationSchemeProvider oauthProvider, IMemoryCache memoryCache, IdentityServerOptions identityServerOptions, //JwtBearerOptions jwtBearerOptions, IOptionsMonitor <MicrosoftAccountOptions> microsoftOptions, IOptionsMonitor <GoogleOptions> googleOptions, IOptionsMonitor <FacebookOptions> facebookOptions, IOptionsMonitor <GitHubAuthenticationOptions> githubOptions, IOptionsMonitor <QQAuthenticationOptions> qqOptions, IOptionsMonitor <WeiboAuthenticationOptions> weiboOptions, IOptionsMonitor <WeixinAuthenticationOptions> weixinOptions ) { _next = next; _oauthProvider = oauthProvider; _memoryCache = memoryCache; _identityServerOptions = identityServerOptions; //_jwtBearerOptions = jwtBearerOptions; _microsoftOptions = microsoftOptions.Get(MicrosoftAccountDefaults.AuthenticationScheme); _googleOptions = googleOptions.Get(GoogleDefaults.AuthenticationScheme); _facebookOptions = facebookOptions.Get(FacebookDefaults.AuthenticationScheme); _githubOptions = githubOptions.Get(GitHubAuthenticationDefaults.AuthenticationScheme); _qqOptions = qqOptions.Get(QQAuthenticationDefaults.AuthenticationScheme); _weiboOptions = weiboOptions.Get(WeiboAuthenticationDefaults.AuthenticationScheme); _weixinOptions = weixinOptions.Get(WeixinAuthenticationDefaults.AuthenticationScheme); }
public static void UseQQAuthentication(this IAppBuilder app, QQAuthenticationOptions options) { if (app == null) { throw new ArgumentNullException("app"); } if (options == null) { throw new ArgumentNullException("options"); } app.Use(typeof(QQAuthenticationMiddleware), app, options); }
/// <summary> /// Adds the <see cref="QQAuthenticationMiddleware"/> middleware to the specified /// <see cref="IApplicationBuilder"/>, which enables QQ authentication capabilities. /// </summary> /// <param name="app">The <see cref="IApplicationBuilder"/> to add the middleware to.</param> /// <param name="configuration">An action delegate to configure the provided <see cref="QQAuthenticationOptions"/>.</param> /// <returns>A reference to this instance after the operation has completed.</returns> public static IApplicationBuilder UseQQAuthentication(this IApplicationBuilder app, Action <QQAuthenticationOptions> configuration) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } var options = new QQAuthenticationOptions(); configuration(options); return(app.UseMiddleware <QQAuthenticationMiddleware>(Options.Create(options))); }
public static IApplicationBuilder UseQQAuthentication(this IApplicationBuilder app, QQAuthenticationOptions options) { throw new NotSupportedException("This method is no longer supported, see https://go.microsoft.com/fwlink/?linkid=845470"); }
/// <summary> /// Creates a builder. /// </summary> /// <param name="authBuilder">The services.</param> /// <returns></returns> public static void AddIdentityServer4MicroServiceOAuths(this AuthenticationBuilder authBuilder) { #region MicrosoftAccount (/signin-microsoft) var microsoft_options = new MicrosoftAccountOptions(); authBuilder.Services.AddSingleton(microsoft_options); authBuilder.AddMicrosoftAccount(x => { x.ClientId = unknow; x.ClientSecret = unknow; authBuilder.Services.Remove(new ServiceDescriptor(typeof(MicrosoftAccountOptions), microsoft_options)); authBuilder.Services.AddSingleton(x); }); #endregion #region Google (/signin-google) var google_options = new GoogleOptions(); authBuilder.Services.AddSingleton(google_options); authBuilder.AddGoogle(x => { x.ClientId = unknow; x.ClientSecret = unknow; authBuilder.Services.Remove(new ServiceDescriptor(typeof(GoogleOptions), google_options)); authBuilder.Services.AddSingleton(x); }); #endregion #region Facebook (/signin-facebook) var facebook_options = new FacebookOptions(); authBuilder.Services.AddSingleton(facebook_options); authBuilder.AddFacebook(x => { x.ClientId = unknow; x.ClientSecret = unknow; authBuilder.Services.Remove(new ServiceDescriptor(typeof(FacebookOptions), facebook_options)); authBuilder.Services.AddSingleton(x); }); #endregion #region GitHub (/signin-github) var github_options = new GitHubAuthenticationOptions(); authBuilder.Services.AddSingleton(github_options); authBuilder.AddGitHub(x => { x.ClientId = unknow; x.ClientSecret = unknow; authBuilder.Services.Remove(new ServiceDescriptor(typeof(GitHubAuthenticationOptions), github_options)); authBuilder.Services.AddSingleton(x); }); #endregion #region QQ (/signin-qq) var qq_options = new QQAuthenticationOptions(); authBuilder.Services.AddSingleton(qq_options); authBuilder.AddQQ(x => { x.ClientId = unknow; x.ClientSecret = unknow; authBuilder.Services.Remove(new ServiceDescriptor(typeof(QQAuthenticationOptions), qq_options)); authBuilder.Services.AddSingleton(x); }); #endregion #region Weibo (/signin-weibo) var weibo_options = new WeiboAuthenticationOptions(); authBuilder.Services.AddSingleton(weibo_options); authBuilder.AddWeibo(x => { x.ClientId = unknow; x.ClientSecret = unknow; authBuilder.Services.Remove(new ServiceDescriptor(typeof(WeiboAuthenticationOptions), weibo_options)); authBuilder.Services.AddSingleton(x); }); #endregion #region Weixin (/signin-weixin) var weixin_options = new WeixinAuthenticationOptions(); authBuilder.Services.AddSingleton(weixin_options); authBuilder.AddWeixin(x => { x.ClientId = unknow; x.ClientSecret = unknow; authBuilder.Services.Remove(new ServiceDescriptor(typeof(WeixinAuthenticationOptions), weixin_options)); authBuilder.Services.AddSingleton(x); }); #endregion }
/// <summary> /// Adds the <see cref="QQAuthenticationMiddleware"/> middleware to the specified /// <see cref="IApplicationBuilder"/>, which enables QQ authentication capabilities. /// </summary> /// <param name="app">The <see cref="IApplicationBuilder"/> to add the middleware to.</param> /// <param name="options">A <see cref="QQAuthenticationOptions"/> that specifies options for the middleware.</param> /// <returns>A reference to this instance after the operation has completed.</returns> public static IApplicationBuilder UseQQAuthentication(this IApplicationBuilder app, QQAuthenticationOptions options) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } return(app.UseMiddleware <QQAuthenticationMiddleware>(Options.Create(options))); }