You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
|
|
using OAuth2Study.Model;
|
|
using OAuth2Study.Model.OAuth2;
|
|
|
|
namespace OAuth2Study.OAuthServer.Controllers
|
|
{
|
|
public class GrantController : Controller
|
|
{
|
|
[HttpGet]
|
|
public ActionResult Index(RequestGrantInfo requestInfo)
|
|
{
|
|
//检查参数
|
|
if (requestInfo == null)
|
|
{
|
|
return RedirectToAction("Error");
|
|
}
|
|
|
|
if (requestInfo.response_type != "authorization_code")
|
|
{
|
|
return RedirectToAction("Error");
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(requestInfo.client_id))
|
|
{
|
|
return RedirectToAction("Error");
|
|
}
|
|
|
|
|
|
ViewData["AgreeUrl"] = "/api/OAuth2/GetAuthCode?" + Request.QueryString;
|
|
ViewData["RejectUrl"] = HttpUtility.HtmlDecode(requestInfo.redirect_uri) + "?code=&state=" + requestInfo.state;
|
|
return View();
|
|
}
|
|
|
|
[Route("Error")]
|
|
public ActionResult Error(string message="出现错误")
|
|
{
|
|
ViewData["Message"] = message;
|
|
return View();
|
|
}
|
|
}
|
|
}
|