mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-19 01:58:01 +08:00
增加Oracle驱动
调整登录时应用判定
This commit is contained in:
@@ -13,14 +13,19 @@ namespace OpenAuth.App
|
||||
/// <summary>
|
||||
/// 分类管理
|
||||
/// </summary>
|
||||
public class AppManager : BaseStringApp<Application,OpenAuthDBContext>
|
||||
public class AppManager : BaseStringApp<Application, OpenAuthDBContext>
|
||||
{
|
||||
public AppManager(IUnitWork<OpenAuthDBContext> unitWork, IRepository<Application, OpenAuthDBContext> repository) : base(unitWork, repository, null)
|
||||
{
|
||||
}
|
||||
|
||||
public void Add(Application Application)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Application.Id))
|
||||
{
|
||||
Application.Id = Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
Repository.Add(Application);
|
||||
}
|
||||
|
||||
@@ -32,13 +37,15 @@ namespace OpenAuth.App
|
||||
|
||||
public async Task<List<Application>> GetList(QueryAppListReq request)
|
||||
{
|
||||
var applications = UnitWork.Find<Application>(null) ;
|
||||
|
||||
var applications = UnitWork.Find<Application>(null);
|
||||
|
||||
return applications.ToList();
|
||||
}
|
||||
|
||||
public AppManager(IUnitWork<OpenAuthDBContext> unitWork, IRepository<Application,OpenAuthDBContext> repository,IAuth auth) : base(unitWork, repository, auth)
|
||||
|
||||
public Application GetByAppKey(string modelAppKey)
|
||||
{
|
||||
return Repository.FirstOrDefault(u => u.AppSecret == modelAppKey);
|
||||
}
|
||||
}
|
||||
}
|
@@ -18,9 +18,9 @@ namespace OpenAuth.App.SSO
|
||||
//这个地方使用IRepository<User> 而不使用UserManagerApp是防止循环依赖
|
||||
public IRepository<User,OpenAuthDBContext> _app;
|
||||
private ICacheContext _cacheContext;
|
||||
private AppInfoService _appInfoService;
|
||||
private AppManager _appInfoService;
|
||||
|
||||
public LoginParse( AppInfoService infoService, ICacheContext cacheContext, IRepository<User,OpenAuthDBContext> userApp)
|
||||
public LoginParse( AppManager infoService, ICacheContext cacheContext, IRepository<User,OpenAuthDBContext> userApp)
|
||||
{
|
||||
_appInfoService = infoService;
|
||||
_cacheContext = cacheContext;
|
||||
@@ -33,12 +33,12 @@ namespace OpenAuth.App.SSO
|
||||
try
|
||||
{
|
||||
model.Trim();
|
||||
//获取应用信息
|
||||
var appInfo = _appInfoService.Get(model.AppKey);
|
||||
if (appInfo == null)
|
||||
{
|
||||
throw new Exception("应用不存在");
|
||||
}
|
||||
//todo:如果需要判定应用,可以取消该注释
|
||||
// var appInfo = _appInfoService.GetByAppKey(model.AppKey);
|
||||
// if (appInfo == null)
|
||||
// {
|
||||
// throw new Exception("应用不存在");
|
||||
// }
|
||||
//获取用户信息
|
||||
User userInfo = null;
|
||||
if (model.Account == Define.SYSTEM_USERNAME)
|
||||
@@ -84,7 +84,6 @@ namespace OpenAuth.App.SSO
|
||||
_cacheContext.Set(currentSession.Token, currentSession, DateTime.Now.AddDays(10));
|
||||
|
||||
result.Code = 200;
|
||||
result.ReturnUrl = appInfo.ReturnUrl;
|
||||
result.Token = currentSession.Token;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@@ -9,6 +9,9 @@ namespace OpenAuth.App.SSO
|
||||
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 应用的AppSecrect,目前没判定可以随便填一个。如果需要判定请根据注释调整LoginParse.Do方法
|
||||
/// </summary>
|
||||
public string AppKey { get; set; }
|
||||
|
||||
public void Trim()
|
||||
|
Reference in New Issue
Block a user