public PassportWithHttpRequest(IPassportStorageService passportStorageService , HttpRequestMessage requestMessage ) : base(passportStorageService) { if (requestMessage != null) { _httpRequestContext = BuildImmutableHttpRequestMessage(requestMessage); } else if (HttpContext.Current != null && HttpContext.Current.Request != null) { _httpRequestContext = BuildImmutableHttpRequest(HttpContext.Current.Request); } _extendedContexts = new [] { new KeyValuePair<string, IContext>(Constants.Passports.KeyHttpRequest, _httpRequestContext) }; }
public PassportWithHttpRequest(IPassportStorageService passportStorageService , HttpRequestMessage requestMessage ) : base(passportStorageService) { if (requestMessage != null) { _httpRequestContext = BuildImmutableHttpRequestMessage(requestMessage); } else if (HttpContext.Current != null && HttpContext.Current.Request != null) { _httpRequestContext = BuildImmutableHttpRequest(HttpContext.Current.Request); } _extendedContexts = new [] { new KeyValuePair <string, IContext>(Constants.Passports.KeyHttpRequest, _httpRequestContext) }; }
static void Main(string[] args) { //var config = new DatadogConfiguration() // //.WithWithStatsdServer("127.0.0.1", 8125) // .WithHostname("passport") // ; var storage = CloudStorageAccount.DevelopmentStorageAccount; var rootLogger = new LoggerConfiguration() //.ReadFrom.AppSettings() //.WriteTo.File("log.txt") //.WriteTo.Sink(new FileSink(@"log.json", new JsonFormatter(false, null, true), null)) //.Enrich.FromLogContext() //.Destructure.UsingAttributes() .Destructure.JsonNetTypes() .WriteTo.AzureTableStorageWithProperties(storage) .MinimumLevel.Debug() //.WriteTo.Loggly() .CreateLogger(); var passportLogger = new LoggerConfiguration() .MinimumLevel.Debug() .WriteTo.Sink(new PassportSink(rootLogger)) .Destructure.JsonNetTypes() .CreateLogger(); _storage = new Storage.Serilog.PassportStorageService(passportLogger); PassportLevel.Current = PassportLevel.Debug; //var result = WithControllerUsingService().Result; var result = WithControllerAsyncTest().Result; System.Console.WriteLine("press any key to continue"); System.Console.ReadKey(); _storage.Flush(); }
public Passport(IPassportStorageService passportStorageService) { PassportStorageService = passportStorageService; Scopes = new PassportScopeManager(); Contexts[Constants.Contexts.Machine] = new MachineContext(); }
public void Setup() { _storage = new PassportStorageService(); _passport = new Passport(_storage); _target = new UserPassportAttributeClass(_passport); }