mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-05-13 10:52:28 -04:00
Merging the authorization branch
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace Kyoo.Authentication
|
||||
{
|
||||
/// <summary>
|
||||
/// The requirement of Kyoo's authentication policies.
|
||||
/// </summary>
|
||||
public class AuthRequirement : IAuthorizationRequirement
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the permission
|
||||
/// </summary>
|
||||
public string Permission { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="AuthRequirement"/> for the given permission.
|
||||
/// </summary>
|
||||
/// <param name="permission">The permission needed</param>
|
||||
public AuthRequirement(string permission)
|
||||
{
|
||||
Permission = permission;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Kyoo.Authentication.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Permission options.
|
||||
/// </summary>
|
||||
public class PermissionOption
|
||||
{
|
||||
/// <summary>
|
||||
/// The path to get this option from the root configuration.
|
||||
/// </summary>
|
||||
public const string Path = "authentication:permissions";
|
||||
|
||||
/// <summary>
|
||||
/// The default permissions that will be given to a non-connected user.
|
||||
/// </summary>
|
||||
public ICollection<string> Default { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Permissions applied to a new user.
|
||||
/// </summary>
|
||||
public ICollection<string> NewUser { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user