mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-04-05 17:38:01 +08:00
update README
This commit is contained in:
parent
781ae8900d
commit
6bd3a04a9d
23
OpenAuth.WebApi/Areas/SSO/Models/Services/AppInfoService.cs
Normal file
23
OpenAuth.WebApi/Areas/SSO/Models/Services/AppInfoService.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OpenAuth.WebApi.Areas.SSO.Models.Services
|
||||||
|
{
|
||||||
|
public class AppInfoService : ServiceContext
|
||||||
|
{
|
||||||
|
public AppInfo Get(string appKey)
|
||||||
|
{
|
||||||
|
//可以从数据库读取
|
||||||
|
return new AppInfo
|
||||||
|
{
|
||||||
|
AppKey = "670b14728ad9902aecba32e22fa4f6bd",
|
||||||
|
AppSecret = "670b14728ad9902aecba32e22fa4f6bd",
|
||||||
|
Icon = "/Content/img/default-app.png",
|
||||||
|
IsEnable = true,
|
||||||
|
Remark = "OpenAuth.net",
|
||||||
|
ReturnUrl = "http://localhost:53050",
|
||||||
|
Title = "OpenAuth.Net",
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
16
OpenAuth.WebApi/Areas/SSO/Models/Services/AppUserService.cs
Normal file
16
OpenAuth.WebApi/Areas/SSO/Models/Services/AppUserService.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
namespace OpenAuth.WebApi.Areas.SSO.Models.Services
|
||||||
|
{
|
||||||
|
public class AppUserService : ServiceContext
|
||||||
|
{
|
||||||
|
public AppUser Get(string username = "")
|
||||||
|
{
|
||||||
|
//模拟用户
|
||||||
|
return new AppUser
|
||||||
|
{
|
||||||
|
Nick = "超级管理员",
|
||||||
|
UserName = username,
|
||||||
|
UserPwd = "xxxxxxxxx"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
using System;
|
||||||
|
using Infrastructure.Cache;
|
||||||
|
|
||||||
|
namespace OpenAuth.WebApi.Areas.SSO.Models.Services
|
||||||
|
{
|
||||||
|
public class UserAuthSessionService : ServiceContext
|
||||||
|
{
|
||||||
|
public UserAuthSessionService()
|
||||||
|
{
|
||||||
|
SetCacheInstance(new SessionContext());
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Create(UserAuthSession model)
|
||||||
|
{
|
||||||
|
//设置缓存
|
||||||
|
return CacheContext.Set(model.Token, model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserAuthSession Get(string token)
|
||||||
|
{
|
||||||
|
var sessionCacheItem = CacheContext.Get<UserAuthSession>(token);
|
||||||
|
return sessionCacheItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool GetCache(string token)
|
||||||
|
{
|
||||||
|
var cache = Get(token);
|
||||||
|
if (cache == null) return false;
|
||||||
|
|
||||||
|
if (cache.InvalidTime > DateTime.Now)
|
||||||
|
{
|
||||||
|
//延长
|
||||||
|
cache.InvalidTime = DateTime.Now.AddMinutes(5);
|
||||||
|
//设置缓存
|
||||||
|
CacheContext.Set(cache.Token, cache);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//移除无效Session缓存
|
||||||
|
Remove(token);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Remove(string token)
|
||||||
|
{
|
||||||
|
CacheContext.Remove(token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,12 @@
|
|||||||
`在线演示地址` http://115.28.10.123:1314
|
`在线演示地址` http://115.28.10.123:1314
|
||||||
|
|
||||||
####项目最新进度
|
####项目最新进度
|
||||||
|
`1.2 正式版(2016-7-8)`
|
||||||
|
|
||||||
|
* 增加SSO单点登录;
|
||||||
|
* 添加WebApi项目,为第三方提供接口;
|
||||||
|
* 添加WebTest项目,模拟第三方网站;
|
||||||
|
|
||||||
`1.1 正式版(2016-5-27)`
|
`1.1 正式版(2016-5-27)`
|
||||||
|
|
||||||
* 实现分级授权,用户只能在自己拥有的资源/部门/角色基础上操作;
|
* 实现分级授权,用户只能在自己拥有的资源/部门/角色基础上操作;
|
||||||
|
Loading…
Reference in New Issue
Block a user