Files
server/util/Setup/AppIdBuilder.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
864 B
C#
Raw Normal View History

// FIXME: Update this file to be null safe and then delete the line below
#nullable disable
namespace Bit.Setup;
2022-08-29 16:06:55 -04:00
2017-10-23 22:45:59 -04:00
public class AppIdBuilder
{
2018-08-30 11:35:44 -04:00
private readonly Context _context;
2022-08-29 16:06:55 -04:00
2017-10-23 22:45:59 -04:00
public AppIdBuilder(Context context)
{
2018-08-30 11:35:44 -04:00
_context = context;
2022-08-29 16:06:55 -04:00
}
2018-08-30 11:35:44 -04:00
public void Build()
2022-08-29 16:06:55 -04:00
{
2018-08-30 11:35:44 -04:00
var model = new TemplateModel
2017-10-23 22:45:59 -04:00
{
2018-08-30 11:35:44 -04:00
Url = _context.Config.Url
2017-10-23 22:45:59 -04: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"))
{
2018-08-30 11:35:44 -04:00
sw.Write(template(model));
2017-10-23 22:45:59 -04:00
}
2022-08-29 16:06:55 -04:00
}
2018-08-30 11:35:44 -04:00
public class TemplateModel
{
public string Url { get; set; }
2017-10-23 22:45:59 -04:00
}
}