[PS-2507] Enable firefox relay address on creation (#2474)

* Enable firefox relay address on creation

Adding a body (json) to the request and setting enabled to true.
Additionally the description is set to "Generated by Bitwarden." to mimick the behaviour of the other clients

* Add missing encoding and mediaType

* Replace JObject with anonymous type
This commit is contained in:
Daniel James Smith 2023-04-14 19:20:35 +02:00 committed by GitHub
parent 0c4b88e562
commit 3a0510d6b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -767,6 +767,12 @@ namespace Bit.Core.Services
break; break;
case ForwardedEmailServiceType.FirefoxRelay: case ForwardedEmailServiceType.FirefoxRelay:
requestMessage.Headers.Add("Authorization", $"Token {config.ApiToken}"); requestMessage.Headers.Add("Authorization", $"Token {config.ApiToken}");
requestMessage.Content = new StringContent(JsonConvert.SerializeObject(
new
{
enabled = true,
description = "Generated by Bitwarden."
}), Encoding.UTF8, "application/json");
break; break;
case ForwardedEmailServiceType.SimpleLogin: case ForwardedEmailServiceType.SimpleLogin:
requestMessage.Headers.Add("Authentication", config.ApiToken); requestMessage.Headers.Add("Authentication", config.ApiToken);