You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Infrastructure;
|
|
|
|
|
using OpenAuth.App.Response;
|
|
|
|
|
using OpenAuth.Repository.Domain;
|
|
|
|
|
|
|
|
|
|
namespace OpenAuth.App
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 授权策略上下文,一个典型的策略模式
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class AuthStrategyContext
|
|
|
|
|
{
|
|
|
|
|
private readonly IAuthStrategy _strategy;
|
|
|
|
|
public AuthStrategyContext(IAuthStrategy strategy)
|
|
|
|
|
{
|
|
|
|
|
this._strategy = strategy;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public SysUser User
|
|
|
|
|
{
|
|
|
|
|
get { return _strategy.User; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<ModuleView> Modules
|
|
|
|
|
{
|
|
|
|
|
get { return _strategy.Modules; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<SysModuleElement> ModuleElements
|
|
|
|
|
{
|
|
|
|
|
get { return _strategy.ModuleElements; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<SysRole> Roles
|
|
|
|
|
{
|
|
|
|
|
get { return _strategy.Roles; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<SysResource> Resources
|
|
|
|
|
{
|
|
|
|
|
get { return _strategy.Resources; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<SysOrg> Orgs
|
|
|
|
|
{
|
|
|
|
|
get { return _strategy.Orgs; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<SysPosition> Positions
|
|
|
|
|
{
|
|
|
|
|
get { return _strategy.Positions; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|