This commit is contained in:
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using System.IdentityModel.Tokens.Jwt;
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
@@ -201,5 +202,19 @@ namespace Ewide.Core.Common
|
|||||||
{
|
{
|
||||||
UpdateWhiteListUser(userID);
|
UpdateWhiteListUser(userID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetPasswordMD5(string password)
|
||||||
|
{
|
||||||
|
var str = password.Trim().ToLower();
|
||||||
|
|
||||||
|
str = BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(UTF8Encoding.Default.GetBytes(str))).Replace("-", "");
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsAuthorized()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ namespace Ewide.Core.WebApi
|
|||||||
// 500
|
// 500
|
||||||
config.Services.Replace(typeof(IHttpActionInvoker), new HttpWebApiControllerActionInvoker(config));
|
config.Services.Replace(typeof(IHttpActionInvoker), new HttpWebApiControllerActionInvoker(config));
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
config.Filters.Add(new ValidateArgumentsFilter());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ using System.Web.Http;
|
|||||||
|
|
||||||
namespace Ewide.Core.WebApi.Areas.Base.Controllers
|
namespace Ewide.Core.WebApi.Areas.Base.Controllers
|
||||||
{
|
{
|
||||||
[ValidateArgumentsFilter]
|
|
||||||
public class GateController : BaseController
|
public class GateController : BaseController
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -16,10 +15,15 @@ namespace Ewide.Core.WebApi.Areas.Base.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dto"></param>
|
/// <param name="dto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[ValidateArgumentsFilter(AllowNull = true)]
|
|
||||||
public IHttpActionResult Login(LoginDTO dto)
|
public IHttpActionResult Login(LoginDTO dto)
|
||||||
{
|
{
|
||||||
return DisplayJSON(dto);
|
return DisplayJSON(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ValidateArgumentsFilter(AllowNull = true)]
|
||||||
|
public IHttpActionResult AllowNullAPI(LoginDTO dto)
|
||||||
|
{
|
||||||
|
return DisplayJSON(dto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using System.Web.Http.Filters;
|
|||||||
|
|
||||||
namespace Ewide.Core.WebApi
|
namespace Ewide.Core.WebApi
|
||||||
{
|
{
|
||||||
|
[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
|
||||||
public class ValidateArgumentsFilter : ActionFilterAttribute
|
public class ValidateArgumentsFilter : ActionFilterAttribute
|
||||||
{
|
{
|
||||||
public bool AllowNull { get; set; } = false;
|
public bool AllowNull { get; set; } = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user