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