//constructor
 public WebCallContextHandlerSettings(LogLevel logLevel         = LogLevel.Basic,
                                      WebHandlerOptions options = WebHandlerOptions.DefaultDebug,
                                      string sessionToken       = "Authorization", WebTokenType sessionTokenType = WebTokenType.Header,
                                      string versionToken       = DefaultVersionToken, string csrfToken          = null,
                                      DbConnectionReuseMode connectionReuseMode = DbConnectionReuseMode.KeepOpen)
 {
     LogLevel            = logLevel;
     Options             = options;
     ConnectionReuseMode = connectionReuseMode;
     if (sessionToken != null)
     {
         TokenHandlers.Add(new WebSessionTokenHandler(sessionToken, sessionTokenType));
     }
     if (versionToken != null)
     {
         TokenHandlers.Add(new VersionTokenHandler(versionToken));
     }
     // Cross-Site Request Forgery (CSRF) protection. Used as header only (not cookie), when session token is saved in cookie,
     // to protect against CSRF execution. Sometimes called synchronization token; read more in Wikipedia or other resources
     if (csrfToken != null)
     {
         TokenHandlers.Add(new WebTokenHandler(csrfToken, WebTokenType.Header, WebTokenDirection.InputOutput));
     }
     //We ignore Swagger paths by default
     IgnorePaths.Add("/swagger");
 }
Esempio n. 2
0
 public OperationContext(EntityApp app, UserInfo user         = null, WebCallContext webContext = null, ILog log = null,
                         DbConnectionReuseMode connectionMode = DbConnectionReuseMode.NoReuse,
                         ProcessType?processType = null, Guid?processId = null)
 {
     App              = app;
     User             = user ?? UserInfo.Anonymous;
     WebContext       = webContext;
     Log              = log ?? new DefaultOperationLog(this);
     DbConnectionMode = connectionMode;
     ProcessId        = processId;
     if (WebContext != null)
     {
         ProcessType = ProcessType.WebRequest;
     }
     else
     {
         if (processType == null)
         {
             ProcessType = (processId == null) ? ProcessType.User : ProcessType.BackgroundProcess;
         }
         else
         {
             ProcessType = processType.Value;
         }
     }
 }
Esempio n. 3
0
 public OperationContext(EntityApp app, UserInfo user         = null, WebCallContext webContext = null,
                         DbConnectionReuseMode connectionMode = DbConnectionReuseMode.NoReuse)
 {
     App              = app;
     User             = user ?? UserInfo.Anonymous;
     WebContext       = webContext;
     DbConnectionMode = connectionMode;
     LocalLog         = new MemoryLog(this);
     Disposables      = new ConcurrentDisposableSet();
 }
Esempio n. 4
0
 //Used for creating System-level context within user operation
 public OperationContext(OperationContext parentContext, UserInfo user)
 {
     App              = parentContext.App;
     User             = user;
     WebContext       = parentContext.WebContext;
     LocalLog         = parentContext.LocalLog;
     UserSession      = parentContext.UserSession;
     DataSourceName   = parentContext.DataSourceName;
     DbConnectionMode = parentContext.DbConnectionMode;
     Disposables      = parentContext.Disposables;
 }
 //constructor
 public WebCallContextHandlerSettings(LogLevel logLevel = LogLevel.Basic,
     WebHandlerOptions options = WebHandlerOptions.DefaultDebug,
     string sessionToken = "Authorization", WebTokenType sessionTokenType = WebTokenType.Header,
     string versionToken = DefaultVersionToken, string csrfToken = null,
     DbConnectionReuseMode connectionReuseMode = DbConnectionReuseMode.KeepOpen)
 {
     LogLevel = logLevel;
       Options = options;
       ConnectionReuseMode = connectionReuseMode;
       if (sessionToken != null)
     TokenHandlers.Add(new WebSessionTokenHandler(sessionToken, sessionTokenType));
       if (versionToken != null)
     TokenHandlers.Add(new VersionTokenHandler(versionToken));
       // Cross-Site Request Forgery (CSRF) protection. Used as header only (not cookie), when session token is saved in cookie,
       // to protect against CSRF execution. Sometimes called synchronization token; read more in Wikipedia or other resources
       if (csrfToken != null)
     TokenHandlers.Add(new WebTokenHandler(csrfToken, WebTokenType.Header, WebTokenDirection.InputOutput));
       //We ignore Swagger paths by default
       IgnorePaths.Add("/swagger");
 }