예제 #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).");
         }
     }
 }
예제 #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);
 }
예제 #4
0
 public void SetInstanceId(string instanceId)
 {
     contextStorage.SetValue(InstanceIdContextKey, instanceId);
 }
예제 #5
0
 public void SetSchoolYear(int schoolYear)
 {
     contextStorage.SetValue(SchoolYearContextKey, schoolYear);
 }
예제 #6
0
 public void SetApiKeyContext(ApiKeyContext apiKeyContext)
 {
     _contextStorage.SetValue(ApiKeyContextKeyName, apiKeyContext);
 }
예제 #7
0
 public void SetResourceUris(string[] resourceUris)
 {
     _contextStorage.SetValue(AuthorizationContextKeys.Resource, resourceUris);
 }