namespace YLErp.Web.Models
{
///
/// 通用单点登录配置
///
public static class GeneralSSOConfig
{
static InnerConfig _config;
///
/// 通用SSO登录是否启用
///
public static bool Enable => _config != null && _config.enable;
///
/// 通用SSO授权地址(SSO服务器的登录地址)
///
public static string AuthUrl => _config?.auth_url;
///
/// 通用SSO回调地址(本系统的回调处理地址)
///
public static string CallbackUrl => _config?.callback_url;
///
/// 通用SSO获取用户信息接口地址
///
public static string GetUserUrl => _config?.get_user_url;
public static void Init()
{
var configFilePath = Server.MapPath("~/app_data/config/通用SSO.json");
if (System.IO.File.Exists(configFilePath))
{
var json = System.IO.File.ReadAllText(configFilePath);
_config = Newtonsoft.Json.JsonConvert.DeserializeObject(json);
}
}
class InnerConfig
{
public bool enable { get; set; }
public string auth_url { get; set; }
public string callback_url { get; set; }
public string get_user_url { get; set; }
}
}
}