/// <summary>
 /// Initializes a new instance of the <see cref="ExceptionShieldingErrorHandler" /> class with
 /// the <see cref="ExceptionShielding.DefaultExceptionPolicy" /> value.
 /// </summary>
 /// <param name="wcfContext">The WCF contexts behavior.</param>
 public ExceptionShieldingErrorHandler(
     IWcfContextUtilities wcfContext)
     : this(wcfContext, ExceptionShielding.DefaultExceptionPolicy)
 {
     if (wcfContext == null)
     {
         throw new ArgumentNullException(nameof(wcfContext));
     }
 }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseHttpAuthorizationManager"/> class.
        /// </summary>
        /// <param name="wcfContext">The WCF context.</param>
        /// <exception cref="System.ArgumentNullException">wcfContext</exception>
        protected BaseHttpAuthorizationManager(
            IWcfContextUtilities wcfContext)
        {
            if (wcfContext == null)
            {
                wcfContext = ServiceLocator.Current.GetInstance <IWcfContextUtilities>();
            }

            WcfContext = wcfContext ?? throw new ArgumentNullException(nameof(wcfContext));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="OpenIdServiceAuthorizationManager" /> class.
        /// </summary>
        /// <param name="tokenValidationParameters">The validation parameters.</param>
        /// <param name="wcfContext">The WCF context.</param>
        /// <exception cref="ArgumentNullException">tokenValidationParameters</exception>
        public OpenIdServiceAuthorizationManager(
            IEnumerable <Lazy <TokenValidationParameters> > tokenValidationParameters,
            IWcfContextUtilities wcfContext = null)
            : base(wcfContext)
        {
            if (tokenValidationParameters == null)
            {
                throw new ArgumentNullException(nameof(tokenValidationParameters));
            }

            _tokenValidationParameters = tokenValidationParameters.ToList();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ExceptionShieldingErrorHandler"/> class.
        /// </summary>
        /// <param name="wcfContext">The WCF contexts behavior.</param>
        /// <param name="exceptionPolicyName">Name of the exception policy.</param>
        public ExceptionShieldingErrorHandler(
            IWcfContextUtilities wcfContext,
            string exceptionPolicyName)
        {
            if (wcfContext == null)
            {
                throw new ArgumentNullException(nameof(wcfContext));
            }
            if (exceptionPolicyName.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("The argument cannot be null, empty string or consist of whitespace characters only.", nameof(exceptionPolicyName));
            }

            _wcfContext         = wcfContext;
            ExceptionPolicyName = exceptionPolicyName;
        }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BasicAuthorizationManager" /> class.
        /// </summary>
        /// <param name="wcfContext">The WCF context.</param>
        /// <param name="authentication">The authentication interface.</param>
        /// <param name="realm">The realm of authentication.</param>
        /// <exception cref="ArgumentException">The argument cannot be null, empty string or consist of whitespace characters only. - realm</exception>
        /// <exception cref="ArgumentNullException">authentication</exception>
        public BasicAuthorizationManager(
            IWcfContextUtilities wcfContext,
            IBasicAuthenticate authentication,
            string realm = null)
            : base(wcfContext)
        {
            if (realm.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("The argument cannot be null, empty string or consist of whitespace characters only.", nameof(realm));
            }

            // if not injected by DI, try the CSL - if still not defined, throw exception
            if (authentication == null)
            {
                authentication = ServiceLocator.Current.GetInstance <IBasicAuthenticate>();
            }
            _authentication = authentication ?? throw new ArgumentNullException(nameof(authentication));

            if (!realm.IsNullOrWhiteSpace())
            {
                _realm = realm;
            }
        }