mirror of
https://bitbucket.org/myhomie/mycorerepository.git
synced 2025-12-06 09:41:19 +00:00
60 lines
1.5 KiB
C#
60 lines
1.5 KiB
C#
using MyCore.Interfaces.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MyCore.Service
|
|
{
|
|
internal static class Security
|
|
{
|
|
public const string Scope = "MyCore-api";
|
|
|
|
/// <summary>
|
|
/// Permissions
|
|
/// </summary>
|
|
private class Permissions
|
|
{
|
|
/// <summary>
|
|
/// Admin access
|
|
/// </summary>
|
|
public const string Admin = "MyCore.admin";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Custom claims types
|
|
/// </summary>
|
|
public class ClaimTypes
|
|
{
|
|
public const string Permission = "Permission";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Permissions for each type of profile
|
|
/// </summary>
|
|
public static readonly Dictionary<System.Type, string[]> ProfilesConfiguration = new Dictionary<System.Type, string[]>()
|
|
{
|
|
// An admin has access to everything
|
|
//{ typeof(AdminProfile), new[] { Permissions.Admin} },
|
|
};
|
|
|
|
/// <summary>
|
|
/// Policies names
|
|
/// </summary>
|
|
public class Policies
|
|
{
|
|
/// <summary>
|
|
/// Administration
|
|
/// </summary>
|
|
public const string Admin = "MyCore.Administration";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Policies
|
|
/// </summary>
|
|
public static readonly Policy[] PoliciesConfiguration = new[]
|
|
{
|
|
new Policy() { Name = Policies.Admin, Claims = new[] { Permissions.Admin} }
|
|
};
|
|
}
|
|
} |