1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-13 06:20:48 -05:00
2025-06-02 14:50:43 -04:00

32 lines
1.1 KiB
C#

using Bit.Core.Enums;
using Bit.Core.IdentityServer;
using Bit.Core.Settings;
using Bit.Identity.IdentityServer.RequestValidators;
using Duende.IdentityServer.Models;
namespace Bit.Identity.IdentityServer.StaticClients;
public static class SendClientBuilder
{
public static Client Build(GlobalSettings globalSettings)
{
return new Client()
{
ClientId = BitwardenClient.Send,
AllowedGrantTypes = new[] { SendAccessGrantValidator.GrantType },
AccessTokenLifetime = 60 * 5, // 5 minutes // TODO: convert this to a global setting
// Do not allow refresh tokens to be issued.
AllowOfflineAccess = false,
// Send is a public anonymous client, so no secret is required (or really possible to use securely).
RequireClientSecret = false,
// Allow web vault to use this client.
AllowedCorsOrigins = new[] { globalSettings.BaseServiceUri.Vault },
// Setup API scopes that the client can request in the scope property of the token request.
AllowedScopes = new string[] { ApiScopes.Send },
};
}
}