Пример #1
0
        /// <summary>
        /// Creates a new instance of the <see cref="ActivityAuthorizer"/> class.
        /// </summary>
        /// <param name="scopeProvider">Scope provider to use</param>
        /// <param name="authorized">Default authorization value</param>
        /// <param name="defaultActivity">Default activity</param>
        /// <param name="allowUnauthenticated">Whether to allow unauthenticated users</param>
        public ActivityAuthorizer(IAuthorizationScopeProvider scopeProvider, bool authorized, string defaultActivity = null, bool allowUnauthenticated = false)
        {
            this.scopeProvider = scopeProvider;

            DefaultAuthorization        = authorized;
            DefaultAllowUnauthenticated = allowUnauthenticated;
            DefaultActivity             = defaultActivity;
        }
 /// <summary>
 /// Creates a new instance of the <see cref="CachingAuthorizationScopeProvider"/> class.
 /// </summary>
 /// <param name="provider">Activity provider to use</param>
 /// <param name="cache">Cache to use</param>
 /// <param name="duration">Cache duration to use (default: 5 mins)</param>
 public CachingAuthorizationScopeProvider(IAuthorizationScopeProvider provider, ICache cache, TimeSpan?duration)
 {
     this.provider = provider;
     this.cache    = cache;
     this.duration = duration ?? TimeSpan.FromMinutes(5);
 }