feat(auth): 添加SSO登录配置和密码登录禁用功能
- 移除 skipSso 参数并优化天风证券SSO登录逻辑 - 添加 ErpElement.DisablePasswordLogin 配置项控制密码登录 - 增加 SSO重定向功能当密码登录被禁用时 - 在appconfig.xml中添加 Erp.DisablePasswordLogin 配置参数 - 在AppUpgrader中初始化DisablePasswordLogin配置数据 - 扩展IErpConfig接口添加DisablePasswordLogin属性定义 - 在ProjectSettings类中实现DisablePasswordLogin属性
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using YLErp.Configuration.Enums;
|
||||
using YLErp.Configuration.Enums;
|
||||
using static YLErp.DBModels.Consts.ConsReport;
|
||||
|
||||
namespace YLErp.Configuration
|
||||
@@ -474,6 +474,11 @@ namespace YLErp.Configuration
|
||||
/// </summary>
|
||||
bool StrictAuthorize { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 禁用账号密码登录(仅允许SSO)
|
||||
/// </summary>
|
||||
bool DisablePasswordLogin { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 风险对冲累积总盈亏是否统计已过期的场内交易
|
||||
/// </summary>
|
||||
|
||||
@@ -541,6 +541,8 @@ namespace YLErp
|
||||
/// </summary>
|
||||
public bool StrictAuthorize { get; set; }
|
||||
|
||||
public bool DisablePasswordLogin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 风险对冲累积总盈亏是否统计已过期的场内交易
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace YLErp.Modules.AppModule
|
||||
{
|
||||
@@ -217,6 +217,8 @@ namespace YLErp.Modules.AppModule
|
||||
data = configService.RemoveData("ProjectConfig", "StrictAuthorize");
|
||||
configService.AddDataIfNotExists("ProjectConfig", "Erp.StrictAuthorize", data?.PValue ?? "false", "bool", "严格的权限验证");
|
||||
|
||||
configService.AddDataIfNotExists("ProjectConfig", "Erp.DisablePasswordLogin", "false", "bool", "禁用账号密码登录,仅允许SSO");
|
||||
|
||||
configService.AddDataIfNotExists("ProjectConfig", "Erp.RiskAccPnl_SumExpiredExchangeTrades", data?.PValue ?? "false", "bool", "风险对冲累积总盈亏是否统计已过期的场内交易");
|
||||
|
||||
//-----------------------------------------------
|
||||
|
||||
@@ -52,5 +52,7 @@
|
||||
<add name="Erp.LoginTokenExpireSeconds" value="36000" remark="登录Token过期时间(秒)" type="int"></add>
|
||||
<add name="Erp.PasswordErrorLimit" value="5" remark="密码错误次数限制" type="int"></add>
|
||||
<add name="Erp.PasswordErrorLockMinutes" value="120" remark="密码错误锁定时间(分钟)" type="int"></add>
|
||||
<add name="Erp.StrictAuthorize" value="true" remark="严格授权模式,开启后登录失败显示验证码" type="bool"></add>
|
||||
<add name="Erp.DisablePasswordLogin" value="true" remark="禁用账号密码登录,仅允许SSO" type="bool"></add>
|
||||
</items>
|
||||
</appconfig>
|
||||
|
||||
@@ -44,11 +44,21 @@ namespace YLErp.Web.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
if (!skipSso && SsoLoginConfig.SSO_Enable && PS.Config.Company == CompanyEnum.天风)
|
||||
if (SsoLoginConfig.SSO_Enable && PS.Config.Company == CompanyEnum.天风)
|
||||
{
|
||||
return View("TianFengLogin");
|
||||
}
|
||||
|
||||
if (PS.Config.ErpElement.DisablePasswordLogin)
|
||||
{
|
||||
var ssoUrl = YLErp.Web.Models.GeneralSSOConfig.AuthUrl;
|
||||
if (!string.IsNullOrEmpty(ssoUrl))
|
||||
{
|
||||
return Redirect(ssoUrl);
|
||||
}
|
||||
return Content("SSO登录未配置,请联系管理员");
|
||||
}
|
||||
|
||||
return LoginError(null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user