-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRouterHandler.cs
More file actions
44 lines (38 loc) · 1.17 KB
/
RouterHandler.cs
File metadata and controls
44 lines (38 loc) · 1.17 KB
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
42
43
44
using System.Web;
using System.Web.Routing;
namespace OpenId.AspNet.Authentication
{
public class RouterHandler : IRouteHandler
{
public RouterHandler()
{
}
public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
return new OpenIdMvcHttpHandler();
}
}
public class OpenIdMvcHttpHandler : IHttpHandler
{
public OpenIdMvcHttpHandler()
{
}
public void ProcessRequest(HttpContext context)
{
var oper = context.Request.Url.Segments[context.Request.Url.Segments.Length - 1];
if(oper == OpenIdAuthentication.Options.Authentication.SignInEndpoint)
{
OpenIdAuthentication.SignInCallback(context);
}
else if(oper == OpenIdAuthentication.Options.Authentication.SignOutCallbackEndpoint)
{
OpenIdAuthentication.SignOutCallback(context);
}
else
{
OpenIdAuthentication.RedirectToError(context, 1000, $"Invalid OperId endpoint: {oper}.");
}
}
public bool IsReusable => false;
}
}