ASP.Net 登录控制器
2021-01-18 18:13
标签:ring web span info sys http filter bsp lin ASP.Net 登录控制器 标签:ring web span info sys http filter bsp lin 原文地址:https://www.cnblogs.com/XJNB/p/13343131.htmlusing System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WebApplication17.Models;
namespace WebApplication17.Controllers
{
[BWActionFilter]
[MyAuthrize]
public class DefaultController : ApiController
{
public int get()
{
return 1;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WebApplication17.Models;
namespace WebApplication17.Controllers
{
public class AccountController : ApiController
{
public string Login(UserInfo user)
{
string token = "";
if (user.Name == "Admin" && user.Pass == "1234")
{
JWTHelper helper = new JWTHelper();
Dictionarystring, object> playload = new Dictionarystring, object>();
playload.Add("Name", user.Name);
playload.Add("Id", user.Id);
token =helper.GetToken(playload, 1200);
}
return token;
}
}
}
上一篇:文件上传下载
下一篇:ASP.Net 过滤器