コード例 #1
0
        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)
            };
        }
コード例 #2
0
        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)
            };
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        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();
        }
コード例 #5
0
 public Passport(IPassportStorageService passportStorageService)
 {
     PassportStorageService = passportStorageService;
     Scopes = new PassportScopeManager();
     Contexts[Constants.Contexts.Machine] = new MachineContext();
 }
コード例 #6
0
 public void Setup()
 {
     _storage  = new PassportStorageService();
     _passport = new Passport(_storage);
     _target   = new UserPassportAttributeClass(_passport);
 }
コード例 #7
0
 public void Setup()
 {
     _storage = new PassportStorageService();
     _passport = new Passport(_storage);
     _target = new UserPassportAttributeClass(_passport);
 }
コード例 #8
0
 public Passport(IPassportStorageService passportStorageService)
 {
     PassportStorageService = passportStorageService;
     Scopes = new PassportScopeManager();
     Contexts[Constants.Contexts.Machine] = new MachineContext();
 }