public ViewModelProtectionHelper(DotvvmSecurityConfiguration config, JsonSerializer serializer = null)
 {
     if (config.EncryptionKey == null) config.EncryptionKey = GenerateRandomKey(32);
     if (config.SigningKey == null) config.SigningKey = GenerateRandomKey(128);
     this.EncryptionKey = config.EncryptionKey;
     this.MacKey = config.SigningKey;
     this.Serializer = serializer ?? new JsonSerializer();
 }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DotvvmConfiguration"/> class.
 /// </summary>
 internal DotvvmConfiguration()
 {
     DefaultCulture = CultureInfo.CurrentCulture.Name;
     Markup         = new DotvvmMarkupConfiguration();
     RouteTable     = new DotvvmRouteTable(this);
     Resources      = new DotvvmResourceRepository();
     Security       = new DotvvmSecurityConfiguration();
     Runtime        = new DotvvmRuntimeConfiguration();
     Styles         = new StyleRepository(this);
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DotvvmConfiguration"/> class.
 /// </summary>
 internal DotvvmConfiguration()
 {
     DefaultCulture = CultureInfo.CurrentCulture.Name;
     Markup         = new DotvvmMarkupConfiguration(new Lazy <JavascriptTranslatorConfiguration>(() => ServiceLocator.GetService <IOptions <JavascriptTranslatorConfiguration> >().Value));
     RouteTable     = new DotvvmRouteTable(this);
     Resources      = new DotvvmResourceRepository();
     Security       = new DotvvmSecurityConfiguration();
     Runtime        = new DotvvmRuntimeConfiguration();
     Styles         = new StyleRepository(this);
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DotvvmConfiguration"/> class.
 /// </summary>
 internal DotvvmConfiguration()
 {
     DefaultCulture = Thread.CurrentThread.CurrentCulture.Name;
     Markup = new DotvvmMarkupConfiguration();
     RouteTable = new DotvvmRouteTable(this);
     Resources = new DotvvmResourceRepository();
     Security = new DotvvmSecurityConfiguration();
     Runtime = new DotvvmRuntimeConfiguration();
     Debug = true;
     Styles = new StyleRepository();
 }