2022-06-30 01:46:41 +02:00
|
|
|
|
namespace Bit.Setup
|
2017-10-24 04:45:59 +02:00
|
|
|
|
{
|
|
|
|
|
public class AppIdBuilder
|
|
|
|
|
{
|
2018-08-30 17:35:44 +02:00
|
|
|
|
private readonly Context _context;
|
|
|
|
|
|
|
|
|
|
public AppIdBuilder(Context context)
|
2017-10-24 04:45:59 +02:00
|
|
|
|
{
|
2018-08-30 17:35:44 +02:00
|
|
|
|
_context = context;
|
2017-10-24 04:45:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Build()
|
|
|
|
|
{
|
2018-08-30 17:35:44 +02:00
|
|
|
|
var model = new TemplateModel
|
|
|
|
|
{
|
|
|
|
|
Url = _context.Config.Url
|
|
|
|
|
};
|
|
|
|
|
|
2022-01-24 12:14:04 +01:00
|
|
|
|
// Needed for backwards compatability with migrated U2F tokens.
|
2019-03-12 15:26:14 +01:00
|
|
|
|
Helpers.WriteLine(_context, "Building FIDO U2F app id.");
|
2017-10-24 04:45:59 +02:00
|
|
|
|
Directory.CreateDirectory("/bitwarden/web/");
|
2018-08-30 17:35:44 +02:00
|
|
|
|
var template = Helpers.ReadTemplate("AppId");
|
2020-03-27 19:36:37 +01:00
|
|
|
|
using (var sw = File.CreateText("/bitwarden/web/app-id.json"))
|
2017-10-24 04:45:59 +02:00
|
|
|
|
{
|
2018-08-30 17:35:44 +02:00
|
|
|
|
sw.Write(template(model));
|
2017-10-24 04:45:59 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-08-30 17:35:44 +02:00
|
|
|
|
|
|
|
|
|
public class TemplateModel
|
|
|
|
|
{
|
|
|
|
|
public string Url { get; set; }
|
|
|
|
|
}
|
2017-10-24 04:45:59 +02:00
|
|
|
|
}
|
|
|
|
|
}
|