last ...
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using xIdentityModels.Dtos;
|
||||
using xIdentityModels.Models;
|
||||
using xModels.Dtos;
|
||||
|
||||
namespace xIdentityService.Interfaces
|
||||
{
|
||||
public interface IXAuthorizationProvider
|
||||
{
|
||||
//
|
||||
#region Scope ...
|
||||
Task<XQueryResult<XScopeDefinitionDto>> QueryScopesAsync(
|
||||
XQuery query,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
Task<XScopeDefinitionDto> GetScopeAsync(
|
||||
string name,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
Task<XScopeDefinitionDto> AddScopeAsync(
|
||||
XScopeDefinitionDto item,
|
||||
XUserClaimsInfoDto userInfo,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
Task<XScopeDefinitionDto> UpdateScopeAsync(
|
||||
string name,
|
||||
XScopeDefinitionDto item,
|
||||
XUserClaimsInfoDto userInfo,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
Task<bool> RemoveScopeAsync(
|
||||
string name,
|
||||
XUserClaimsInfoDto userInfo,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Role ...
|
||||
Task<IEnumerable<XRoleDefinitionDto>> GetRolesAsync(
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
Task<XRoleDefinitionDto> GetRoleAsync(
|
||||
string name,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
Task<XRoleDefinitionDto> AddRoleAsync(
|
||||
XRoleDefinitionDto item,
|
||||
XUserClaimsInfoDto userInfo,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
Task<XRoleDefinitionDto> UpdateRoleAsync(
|
||||
string name,
|
||||
XRoleDefinitionDto item,
|
||||
XUserClaimsInfoDto userInfo,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
Task<bool> RemoveRoleAsync(
|
||||
string name,
|
||||
XUserClaimsInfoDto userInfo,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
Task<int> CountUsersInRoleAsync(
|
||||
string name,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Policy ...
|
||||
Task<XQueryResult<XPolicyDefinitionDto>> QueryPoliciesAsync(
|
||||
XQuery query,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
Task<XPolicyDefinitionDto> GetPolicyAsync(
|
||||
string name,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
Task<XPolicyDefinitionDto> AddPolicyAsync(
|
||||
XPolicyDefinitionDto item,
|
||||
XUserClaimsInfoDto userInfo,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
Task<XPolicyDefinitionDto> UpdatePolicyAsync(
|
||||
string name,
|
||||
XPolicyDefinitionDto item,
|
||||
XUserClaimsInfoDto userInfo,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
Task<bool> RemovePolicyAsync(
|
||||
string name,
|
||||
XUserClaimsInfoDto userInfo,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
Task<XPolicyEvaluationResultDto> EvaluatePolicyAsync(
|
||||
string name,
|
||||
XUserClaimsInfoDto target,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
Task<XEffectiveAuthorizationDto> GetEffectiveAuthorizationAsync(
|
||||
XUserClaimsInfoDto target,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Utilities ...
|
||||
Task SyncAllAsync(CancellationToken cancellationToken = default);
|
||||
Task InvalidateAsync(string policyName = null);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xIdentityService.Interfaces
|
||||
{
|
||||
public interface IXRoleHierarchyResolver
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieve All Enabled Role Names which Weight >= minWeight ...
|
||||
/// </summary>
|
||||
/// <param name="minWeight"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<string>> GetRolesByMinWeightAsync(
|
||||
int minWeight,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve Effective Roles for a Policy
|
||||
/// (explicit RequiredRoles ∪ roles by MinRoleWeight ∪ parents chain) ...
|
||||
/// </summary>
|
||||
/// <param name="explicitRoles"></param>
|
||||
/// <param name="minRoleWeight"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<string>> ResolveEffectiveRolesAsync(
|
||||
IEnumerable<string> explicitRoles,
|
||||
int? minRoleWeight,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace xIdentityService.Interfaces
|
||||
{
|
||||
public interface IXScopeSyncService
|
||||
{
|
||||
/// <summary>
|
||||
/// Implemented on xIds over IdentityServer4 ConfigurationDbContext ...
|
||||
/// </summary>
|
||||
public interface IXScopeSyncService
|
||||
{
|
||||
Task UpsertAsync(XScopeDefinition scope, CancellationToken cancellationToken = default);
|
||||
Task RemoveAsync(string scopeName, CancellationToken cancellationToken = default);
|
||||
Task<bool> IsApiResourceExistsAsync(string apiResourceName, CancellationToken cancellationToken = default);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implemented on xIds over RoleManager<IdentityRole> ...
|
||||
/// </summary>
|
||||
public interface IXRoleSyncService
|
||||
{
|
||||
Task UpsertAsync(XRoleDefinition role, CancellationToken cancellationToken = default);
|
||||
Task RemoveAsync(string roleName, CancellationToken cancellationToken = default);
|
||||
Task<int> CountUsersInRoleAsync(string roleName, CancellationToken cancellationToken = default);
|
||||
Task<IEnumerable<string>> GetUserRolesAsync(string userSelectByParam, CancellationToken cancellationToken = default);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user