mirror of
https://github.com/bitwarden/server.git
synced 2025-02-18 02:11:22 +01:00
respect allowanonymous on scim auth (#2173)
This commit is contained in:
parent
37641ba08b
commit
4fc5347f15
@ -1,8 +1,10 @@
|
|||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace Bit.Scim.Controllers
|
namespace Bit.Scim.Controllers
|
||||||
{
|
{
|
||||||
|
[AllowAnonymous]
|
||||||
public class InfoController : Controller
|
public class InfoController : Controller
|
||||||
{
|
{
|
||||||
[HttpGet("~/alive")]
|
[HttpGet("~/alive")]
|
||||||
|
@ -5,6 +5,7 @@ using Bit.Core.Repositories;
|
|||||||
using Bit.Scim.Context;
|
using Bit.Scim.Context;
|
||||||
using IdentityModel;
|
using IdentityModel;
|
||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
namespace Bit.Scim.Utilities
|
namespace Bit.Scim.Utilities
|
||||||
@ -32,6 +33,12 @@ namespace Bit.Scim.Utilities
|
|||||||
|
|
||||||
protected override async Task<AuthenticateResult> HandleAuthenticateAsync()
|
protected override async Task<AuthenticateResult> HandleAuthenticateAsync()
|
||||||
{
|
{
|
||||||
|
var endpoint = Context.GetEndpoint();
|
||||||
|
if (endpoint?.Metadata?.GetMetadata<IAllowAnonymous>() != null)
|
||||||
|
{
|
||||||
|
return AuthenticateResult.NoResult();
|
||||||
|
}
|
||||||
|
|
||||||
if (!_scimContext.OrganizationId.HasValue || _scimContext.Organization == null)
|
if (!_scimContext.OrganizationId.HasValue || _scimContext.Organization == null)
|
||||||
{
|
{
|
||||||
Logger.LogWarning("No organization.");
|
Logger.LogWarning("No organization.");
|
||||||
|
Loading…
Reference in New Issue
Block a user