mirror of
https://github.com/bitwarden/server.git
synced 2025-05-29 23:34:53 -05:00
web policy for two factor apis
This commit is contained in:
parent
eea2ae30b4
commit
12da107c51
@ -15,7 +15,7 @@ using Newtonsoft.Json;
|
|||||||
namespace Bit.Api.Controllers
|
namespace Bit.Api.Controllers
|
||||||
{
|
{
|
||||||
[Route("two-factor")]
|
[Route("two-factor")]
|
||||||
[Authorize("Application")]
|
[Authorize("Web")]
|
||||||
public class TwoFactorController : Controller
|
public class TwoFactorController : Controller
|
||||||
{
|
{
|
||||||
private readonly IUserService _userService;
|
private readonly IUserService _userService;
|
||||||
|
@ -79,6 +79,15 @@ namespace Bit.Api
|
|||||||
policy.AddAuthenticationSchemes("Bearer2", "Bearer3");
|
policy.AddAuthenticationSchemes("Bearer2", "Bearer3");
|
||||||
policy.RequireAuthenticatedUser();
|
policy.RequireAuthenticatedUser();
|
||||||
policy.RequireClaim(JwtClaimTypes.AuthenticationMethod, "Application");
|
policy.RequireClaim(JwtClaimTypes.AuthenticationMethod, "Application");
|
||||||
|
policy.RequireClaim(JwtClaimTypes.Scope, "api");
|
||||||
|
});
|
||||||
|
config.AddPolicy("Web", policy =>
|
||||||
|
{
|
||||||
|
policy.AddAuthenticationSchemes("Bearer2", "Bearer3");
|
||||||
|
policy.RequireAuthenticatedUser();
|
||||||
|
policy.RequireClaim(JwtClaimTypes.AuthenticationMethod, "Application");
|
||||||
|
policy.RequireClaim(JwtClaimTypes.Scope, "api");
|
||||||
|
policy.RequireClaim(JwtClaimTypes.ClientId, "web");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user