11
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BLL.Common
|
||||
{
|
||||
public class AccessTokenModel
|
||||
{
|
||||
public string token_type { get; set; }
|
||||
|
||||
public string scope { get; set; }
|
||||
|
||||
public int expires_in { get; set; }
|
||||
|
||||
public int ext_expires_in { get; set; }
|
||||
|
||||
public string access_token { get; set; }
|
||||
|
||||
public string refresh_token { get; set; }
|
||||
|
||||
public string id_token { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -95,6 +95,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AccessTokenModel.cs" />
|
||||
<Compile Include="APIService\APIEpojectService.cs" />
|
||||
<Compile Include="APIService\SyncUserInfoService.cs" />
|
||||
<Compile Include="BaseInfo\ActTypeService.cs" />
|
||||
|
||||
@@ -3,6 +3,8 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Security;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -55,6 +57,40 @@ namespace BLL.Common
|
||||
}
|
||||
return strPostReponse;
|
||||
}
|
||||
private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
|
||||
{
|
||||
return true; //总是接受
|
||||
}
|
||||
|
||||
public static string PostJsonByHttps(string url, string jsonParams)
|
||||
{
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
|
||||
HttpWebRequest request = null;
|
||||
CookieContainer cookie = new CookieContainer();
|
||||
//HTTPSQ请求
|
||||
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
|
||||
request = WebRequest.Create(url) as HttpWebRequest;
|
||||
request.CookieContainer = cookie;
|
||||
request.ProtocolVersion = HttpVersion.Version11;
|
||||
request.Method = "POST";
|
||||
request.ContentType = "application/x-www-form-urlencoded";
|
||||
request.KeepAlive = true;
|
||||
byte[] byteData = Encoding.UTF8.GetBytes(jsonParams);
|
||||
int length = byteData.Length;
|
||||
request.ContentLength = length;
|
||||
|
||||
using (Stream stream = request.GetRequestStream())
|
||||
{
|
||||
stream.Write(byteData, 0, byteData.Length);
|
||||
}
|
||||
|
||||
var response = (HttpWebResponse)request.GetResponse();
|
||||
|
||||
using (StreamReader st = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("utf-8")))
|
||||
{
|
||||
return st.ReadToEnd().ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private static HttpWebRequest CreateHttpRequest(string url, string requestType, string token, params object[] strJson)
|
||||
{
|
||||
|
||||
@@ -123,6 +123,26 @@ namespace BLL
|
||||
DDL.Items.Insert(0, new System.Web.UI.WebControls.ListItem(itemText, BLL.Const._Null));
|
||||
return;
|
||||
}
|
||||
// 单点登陆ClientId参数
|
||||
public static string ClientId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
// 单点登陆ClientSecret参数
|
||||
public static string ClientSecret
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
// 单点登陆Redirect_url参数
|
||||
public static string Redirect_url
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为目标下拉框加上 "请选择" 项
|
||||
|
||||
Reference in New Issue
Block a user