|
@@ -0,0 +1,80 @@
|
|
|
+using Microsoft.AspNetCore.Hosting;
|
|
|
+using Microsoft.AspNetCore.Http;
|
|
|
+using Microsoft.AspNetCore.Mvc;
|
|
|
+using TEAMModelOS.SDK.DI;
|
|
|
+using TEAMModelOS.SDK;
|
|
|
+using TEAMModelOS.Models;
|
|
|
+using Microsoft.Extensions.Configuration;
|
|
|
+using Microsoft.Extensions.Logging;
|
|
|
+using Microsoft.Extensions.Options;
|
|
|
+using Microsoft.AspNetCore.Authorization;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using TEAMModelOS.Controllers.Third.LePei;
|
|
|
+using Microsoft.Azure.Amqp.Encoding;
|
|
|
+using System;
|
|
|
+using TEAMModelOS.SDK.Extension;
|
|
|
+using System.Text.Json;
|
|
|
+
|
|
|
+
|
|
|
+namespace TEAMModelOS.Controllers.Third.XunFeiJYY
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// 讯飞教育云
|
|
|
+ /// </summary>
|
|
|
+ [ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
+ [ProducesResponseType(StatusCodes.Status400BadRequest)]
|
|
|
+ [ApiController]
|
|
|
+ [Route("xunfei-jjy")]
|
|
|
+ public class XunFeilJYYController : ControllerBase
|
|
|
+ {
|
|
|
+ public static readonly string authurl = "http://www.jyyun.com/sso-oauth/authorize";
|
|
|
+ public static readonly string url= "https://open.jyyun.com";
|
|
|
+ public static readonly string appid = "ea4e44e1dea54caba7b06bdea72970fa";
|
|
|
+ public static readonly string appsecret = "bb79a189fb9c22e9ae1a62b279a112c0";
|
|
|
+ public static readonly string apikey = "305C300D06092A864886F70D0101010500034B003048024100C362EAB80DDFD682367592DD8274A40A9FE9F37DDEC56AC8E0FBE4A5A6D9F6FDAAA495460821CA94EF4A955B582822D7BB289142F2C562FC04DA2D3B940C3D730203010001";
|
|
|
+ public static readonly string testuserid = "fbc284072a40da84adbe206f721b3285bc5101240c006447328c7afa3b7ae20d122a14a73144eea261756cce3e83c3f6ef940d9e8d823c7c";
|
|
|
+ public static readonly string testschlid = "fbc284072a40da841b643aa367013eb18a1d351ed46b0feb15f629530e2f3c1137ae30823af5c69d3b88ef0fa3c761efee102032fc5d2a5a";
|
|
|
+ private readonly AzureCosmosFactory _azureCosmos;
|
|
|
+ private readonly DingDing _dingDing;
|
|
|
+ private readonly Option _option;
|
|
|
+ private readonly AzureStorageFactory _azureStorage;
|
|
|
+ private readonly CoreAPIHttpService _coreAPIHttpService;
|
|
|
+ private readonly IWebHostEnvironment _environment;
|
|
|
+ private readonly IConfiguration _configuration;
|
|
|
+ private readonly ILogger<XunFeilJYYController> _logger;
|
|
|
+
|
|
|
+ public XunFeilJYYController(ILogger<XunFeilJYYController> logger, IConfiguration configuration, IWebHostEnvironment environment,
|
|
|
+ CoreAPIHttpService coreAPIHttpService, AzureStorageFactory azureStorage, DingDing dingDing, AzureCosmosFactory azureCosmos, IOptionsSnapshot<Option> option)
|
|
|
+ {
|
|
|
+ _logger = logger;
|
|
|
+ _configuration = configuration;
|
|
|
+ _environment = environment;
|
|
|
+ _coreAPIHttpService = coreAPIHttpService;
|
|
|
+ _azureStorage = azureStorage;
|
|
|
+ _dingDing = dingDing;
|
|
|
+ _azureCosmos = azureCosmos;
|
|
|
+ _option = option?.Value;
|
|
|
+ }
|
|
|
+ [HttpPost("gen-sso")]
|
|
|
+ [AllowAnonymous]
|
|
|
+ public async Task<IActionResult> Sso(JsonElement json )
|
|
|
+ {
|
|
|
+ json.TryGetProperty("p", out var p);
|
|
|
+ if ($"{p}".Equals("xunfei-jjy-sso"))
|
|
|
+ {
|
|
|
+ string HostName = HttpContext.GetHostName();
|
|
|
+ if (!string.IsNullOrWhiteSpace(_option.HostName))
|
|
|
+ {
|
|
|
+ HostName = _option.HostName;
|
|
|
+ }
|
|
|
+ string xunfei_url = $"{authurl}?appkey={appid}&redirectUri=https://{HostName}/xunfei-jjy/sso&state={DateTimeOffset.Now.ToUnixTimeMilliseconds()}&display=web";
|
|
|
+ return Ok(new { xunfei_url, code = 200 });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return Ok(new { code = 400, msg = "参数错误" });
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|