登录信息加密
parent
678858962b
commit
ce08f1a788
|
|
@ -1,4 +1,6 @@
|
|||
using Infrastructure;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Infrastructure;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using OpenAuth.App;
|
||||
|
|
@ -194,6 +196,30 @@ namespace OpenAuth.WebApi.Controllers
|
|||
#endregion
|
||||
|
||||
#region 登录
|
||||
/// <summary>
|
||||
/// 获取公钥
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public Response<string> GetPubKey()
|
||||
{
|
||||
var resp = new Response<string>();
|
||||
try
|
||||
{
|
||||
var configuration = ConfigHelper.GetConfigRoot();
|
||||
resp.Result = configuration["AppSetting:pubKey"];
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
resp.Code = 500;
|
||||
resp.Result = "";
|
||||
resp.Message = e.Message;
|
||||
}
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录接口
|
||||
/// </summary>
|
||||
|
|
@ -203,8 +229,14 @@ namespace OpenAuth.WebApi.Controllers
|
|||
[AllowAnonymous]
|
||||
public Response<LoginResult> Login(PassportLoginRequest request)
|
||||
{
|
||||
//var aaaa = Md5Helper.Encrypt(DESEncrypt.Encrypt(Md5Helper.Hash("x9p$E$Bxc$v1kViqZTJ1%#0sORIhf*^3"), "390cbc0b25469cc5").ToLower(), 32).ToLower();
|
||||
return _authUtil.Login(request.AppKey, request.Account, request.Password);
|
||||
//获取秘钥
|
||||
RSACryptoServiceProvider rsa = new();
|
||||
var configuration = ConfigHelper.GetConfigRoot();
|
||||
var priKey = configuration["AppSetting:priKey"];
|
||||
rsa.FromXmlString(priKey);
|
||||
var cipherbytex = rsa.Decrypt(Convert.FromBase64String(request.Password), false);
|
||||
var password = Encoding.UTF8.GetString(cipherbytex);
|
||||
return _authUtil.Login(request.AppKey, request.Account, password);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@
|
|||
"SchemeId": "3b01384d-a42e-4772-8752-6fbf40f85959",
|
||||
"IMOpen": true,
|
||||
"IMUrl": "",
|
||||
"LimitShpDistance": 50
|
||||
"LimitShpDistance": 50,
|
||||
"pubKey": "-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDubSHlsvTLzwPOadDjGMX9Kld9Gmh9PClhGFOCnMlQ/FnDuyQU3wg+f6pRu/In1uXVhRo/1uZQTloyoRts6OcunfFgRqHzMDsHweZjCGJ4aa2O7vy442cUzB7vViVvpd5IUmNBhqmjbq+zStH1wPRAreVUfB2M9koCBbj7I8khQIDAQAB-----END PUBLIC KEY-----",
|
||||
"priKey": "<RSAKeyValue><Modulus>w7m0h5bL0y88DzmnQ4xjF/SpXfRpofTwpYRhTgpzJUPxZw7skFN8IPn+qUbvyJ9bl1YUaP9bmUE5aMqEbbOjnLp3xYEah8zA7B8HmYwhieGmtju78uONnFMwe71Ylb6XeSFJjQYapo26vs0rR9cD0QK3lVHwdjPZKAgW4+yPJIU=</Modulus><Exponent>AQAB</Exponent><P>4vFfR62AQ4I5pzQqTDZ4iK/kC2SeCRY77ERVl44ZXUY6zCfdngWPg0AC62ghtCEL/LdnV5xNgTZlkAHFZN0oFw==</P><Q>3MkaGHDthRV/Q+FQwXH8EeQJ2pwFHeRj+eiDMCGyhl4oq6PI9tSdCbtDoyG4WYJkifb3yBetyvZpsd4PxEkdww==</Q><DP>J1ykIQOH1q20oDqdB4D/IP4Y+JzoCD1yAUXM7q932MTAl/5mIu1l+ebVWs1B40NEF/4bj4eNrdaogPS9rwPo2w==</DP><DQ>MNJXbugp3a/vQHdmgCBQeTRP6YNurjl+0hhUSiRpccUIgUvqeIpzX1+FiWE/fquSx99Q03JJAASVQru0CNeSOQ==</DQ><InverseQ>Fra8psqJyh4rhWyeQ1jj0OicQZp6YVyiVdLLAj2g1IVGNFylV+bQWD/ZO9cCuloZmTd58bofSgZlY4IqB8U2/w==</InverseQ><D>V/bISf/dzyX1aipRICyiBIwy6kUEjINW/CyIxtgvc9obTmQIsbyzluaEK3P0JEhqk5NeTOonMrN7p7sM1Xjc2LREC0jvxImGMrrv4ACbTpLIwDy3mFh5/vTHo5+gokfC5ENuj/jqL2rSoqoTRxIwPGzCfxcI03v3m1ZKPFpacWk=</D></RSAKeyValue>"
|
||||
},
|
||||
"PgSql": {
|
||||
"PostGisPath": "E:\\DevelopTools\\PostgreSQL\\14\\bin",
|
||||
|
|
|
|||
Loading…
Reference in New Issue