using Microsoft.Extensions.Configuration;
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;
///
/// 初始化SSO配置
///
/// 配置对象
public static void Init(IConfiguration config)
{
if (config != null)
{
_config = config.GetSection("GeneralSSO").Get();
}
}
///
/// 初始化SSO配置(兼容旧方法)
///
public static void Init()
{
// 保留旧方法以保持向后兼容
}
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; }
}
}
}