mirror of
https://github.com/bitwarden/server
synced 2026-01-09 12:03:21 +00:00
internal identity authorization
This commit is contained in:
@@ -6,7 +6,7 @@ using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace Bit.Hub
|
||||
{
|
||||
[Authorize("Application")]
|
||||
[Authorize("Internal")]
|
||||
public class EventsController : Controller
|
||||
{
|
||||
private readonly IHubContext<SyncHub> _syncHubContext;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Bit.Core;
|
||||
using Bit.Core.Utilities;
|
||||
using IdentityModel;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
@@ -37,7 +38,20 @@ namespace Bit.Hub
|
||||
services.AddScoped<CurrentContext>();
|
||||
|
||||
// Identity
|
||||
services.AddIdentityAuthenticationServices(globalSettings, Environment);
|
||||
services.AddIdentityAuthenticationServices(globalSettings, Environment, config =>
|
||||
{
|
||||
config.AddPolicy("Application", policy =>
|
||||
{
|
||||
policy.RequireAuthenticatedUser();
|
||||
policy.RequireClaim(JwtClaimTypes.AuthenticationMethod, "Application");
|
||||
policy.RequireClaim(JwtClaimTypes.Scope, "api");
|
||||
});
|
||||
config.AddPolicy("Internal", policy =>
|
||||
{
|
||||
policy.RequireAuthenticatedUser();
|
||||
policy.RequireClaim(JwtClaimTypes.Scope, "internal");
|
||||
});
|
||||
});
|
||||
|
||||
// SignalR
|
||||
services.AddSignalR();
|
||||
|
||||
Reference in New Issue
Block a user