Esempio n. 1
0
 /// <summary>
 /// Saves a value using into context using the specified key.
 /// </summary>
 /// <param name="key">The key to use when storing/retrieving the value.</param>
 /// <param name="value">The value to be stored.</param>
 public void SetValue(string key, object value)
 {
     if (HttpContext.Current != null)
     {
         HttpContext.Current.Items[key] = value;
     }
     else
     {
         if (_next != null)
         {
             // Pass call through to the secondary context storage
             _next.SetValue(key, value);
         }
         else
         {
             throw new NullReferenceException(
                       "HttpContext.Current is null and no secondary IContextStorage was provided (useful in situations where context needs to be passed from HttpContext to worker threads in an ASP.NET application).");
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Sets the <see cref="SnapshotContext" /> for the current API request.
 /// </summary>
 /// <param name="snapshotContext">The snapshot context to be set.</param>
 public void SetSnapshotContext(SnapshotContext snapshotContext)
 {
     _contextStorage.SetValue(SnapshotContextKeyName, snapshotContext);
 }
 /// <inheritdoc cref="IAuthorizationFilterContextProvider.SetFilterContext" />
 public void SetFilterContext(IReadOnlyList <AuthorizationStrategyFiltering> filters)
 {
     // Store the filters into context
     _contextStorage.SetValue(FilterContextKeyName, filters);
 }
Esempio n. 4
0
 public void SetInstanceId(string instanceId)
 {
     contextStorage.SetValue(InstanceIdContextKey, instanceId);
 }
Esempio n. 5
0
 public void SetSchoolYear(int schoolYear)
 {
     contextStorage.SetValue(SchoolYearContextKey, schoolYear);
 }
 public void SetApiKeyContext(ApiKeyContext apiKeyContext)
 {
     _contextStorage.SetValue(ApiKeyContextKeyName, apiKeyContext);
 }
Esempio n. 7
0
 public void SetResourceUris(string[] resourceUris)
 {
     _contextStorage.SetValue(AuthorizationContextKeys.Resource, resourceUris);
 }