-
Notifications
You must be signed in to change notification settings - Fork 71
/
AppBuilderExtensions.cs
41 lines (37 loc) · 1.06 KB
/
AppBuilderExtensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using Owin;
using System;
namespace OAuth2.QQConnect.Owin
{
public static class AppBuilderExtensions
{
public static IAppBuilder UseQQConnectAuthentication(
this IAppBuilder app,
string clientId,
string clientSercet)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
return app.UseQQConnectAuthentication(new QQConnectOAuthOptions
{
ClientId = clientId,
ClientSecret = clientSercet
});
}
public static IAppBuilder UseQQConnectAuthentication(
this IAppBuilder app,
QQConnectOAuthOptions options)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
if (options == null)
{
throw new ArgumentNullException(nameof(options));
}
return app.Use(typeof(QQConnectOAuthMiddleware), app, options);
}
}
}