Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AuthorizationContext"/> class.
        /// </summary>
        /// <param name="kernel">The kernel.</param>
        /// <param name="authorizationStore">The <see cref="IAuthorizationStore"/>.</param>
        /// <param name="authorizationHandler">The <see cref="IAuthorizationHandler"/>.</param>
        /// <param name="authorizationContextConfiguration">The <see cref="IAuthorizationContextConfiguration"/>.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="kernel"/>', '<paramref name="authorizationHandler"/>', '<paramref name="authorizationStore"/>' and '<paramref name="authorizationContextConfiguration"/>' cannot be null. </exception>
        public AuthorizationContext([NotNull] IKernel kernel, [NotNull] IAuthorizationStore authorizationStore, [NotNull] IAuthorizationHandler authorizationHandler, [NotNull] IAuthorizationContextConfiguration authorizationContextConfiguration)
        {
            if (kernel == null)
            {
                throw new ArgumentNullException(nameof(kernel));
            }

            if (authorizationStore == null)
            {
                throw new ArgumentNullException(nameof(authorizationStore));
            }

            if (authorizationHandler == null)
            {
                throw new ArgumentNullException(nameof(authorizationHandler));
            }

            if (authorizationContextConfiguration == null)
            {
                throw new ArgumentNullException(nameof(authorizationContextConfiguration));
            }

            this.Kernel               = kernel;
            this.authorizationStore   = authorizationStore;
            this.authorizationHandler = authorizationHandler;
            this.AuthorizationContextConfiguration = authorizationContextConfiguration;
            this.AuthorizationContextState         = new UnauthorizedAuthorizationContextState(authorizationStore, authorizationHandler);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceAccountAuthorizationHandler"/> class.
 /// </summary>
 /// <param name="x509CertificateFactory">An implementation of the <see cref="IX509Certificate2Factory"/>.</param>
 /// <param name="authorizationContextConfiguration">An instance of the <see cref="IAuthorizationContextConfiguration"/> which contains information about the endpoints.</param>
 /// <param name="queryfyDotNet">The <see cref="IQueryfyDotNet"/>.</param>
 /// <param name="httpClient">The <see cref="HttpClient"/>.</param>
 public ServiceAccountAuthorizationHandler(
     IX509Certificate2Factory x509CertificateFactory,
     IAuthorizationContextConfiguration authorizationContextConfiguration,
     IQueryfyDotNet queryfyDotNet,
     HttpClient httpClient)
     : base(authorizationContextConfiguration, queryfyDotNet, httpClient)
 {
     this.x509CertificateFactory = x509CertificateFactory;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GoogleRequestProcessor"/> class.
        /// </summary>
        /// <param name="httpClient">The <see cref="HttpClient"/>.</param>
        /// <param name="authorizationContextConfiguration">The <see cref="IAuthorizationContextConfiguration"/>.</param>
        /// <param name="requestMessageFactory">The <see cref="IHttpRequestMessageFactory"/> that creates <see cref="HttpRequestMessage"/> instances from an <see cref="object"/>.</param>
        /// <param name="responseHeaderMapper">The <see cref="IResponseHeaderMapper"/>.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="authorizationContextConfiguration"/>', '<paramref name="httpClient"/>', '<paramref name="requestMessageFactory"/>' and '<paramref name="responseHeaderMapper"/>' cannot be null. </exception>
        public GoogleRequestProcessor([NotNull] HttpClient httpClient, [NotNull] IAuthorizationContextConfiguration authorizationContextConfiguration, [NotNull] IHttpRequestMessageFactory requestMessageFactory, [NotNull] IResponseHeaderMapper responseHeaderMapper)
            : base(httpClient, requestMessageFactory, responseHeaderMapper)
        {
            if (authorizationContextConfiguration == null)
            {
                throw new ArgumentNullException(nameof(authorizationContextConfiguration));
            }

            this.HttpClient.BaseAddress = authorizationContextConfiguration.BaseUrl;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IAuthorizationStore"/>.
        /// </summary>fg
        /// <param name="configuration">The configuration.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="configuration"/>' cannot be null. </exception>
        public FileSystemAuthorizationStore(IAuthorizationContextConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            this.configuration = configuration;
            this.serializer    = new BinaryFormatter();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GoogleServiceBase"/> class.
        /// </summary>
        /// <param name="requestExecutionStrategy">The <see cref="IRequestExecutionStrategy"/>.</param>
        /// <param name="authorizationContextConfiguration">The <see cref="IAuthorizationContextConfiguration"/>.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="authorizationContextConfiguration"/>' and '<paramref name="requestExecutionStrategy"/>' cannot be null. </exception>
        public GoogleServiceBase([NotNull] IRequestExecutionStrategy requestExecutionStrategy,
                                 [NotNull] IAuthorizationContextConfiguration authorizationContextConfiguration)
            : base(requestExecutionStrategy)
        {
            if (authorizationContextConfiguration == null)
            {
                throw new ArgumentNullException(nameof(authorizationContextConfiguration));
            }

            this.AuthorizationContextConfiguration = authorizationContextConfiguration;
        }
Ejemplo n.º 6
0
        /// <summary>Initializes a new instance of the <see cref="UserInteractiveAuthorizationHandler"/> class.</summary>
        /// <param name="accessCodeRetriever">An implementation of the <see cref="IAccessCodeHandler"/> interface.</param>
        /// <param name="configuration">An instance of the <see cref="IAuthorizationContextConfiguration"/>.</param>
        /// <param name="queryfyDotNet">The <see cref="IQueryfyDotNet"/>.</param>
        /// <param name="httpClient">The <see cref="HttpClient"/>.</param>
        public UserInteractiveAuthorizationHandler([NotNull] IAccessCodeHandler accessCodeRetriever,
                                                   IAuthorizationContextConfiguration configuration,
                                                   IQueryfyDotNet queryfyDotNet,
                                                   HttpClient httpClient)
            : base(configuration, queryfyDotNet, httpClient)
        {
            if (accessCodeRetriever == null)
            {
                throw new ArgumentNullException(nameof(accessCodeRetriever));
            }

            this.accessCodeRetriever = accessCodeRetriever;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OAuth2EndpointBuilder"/> class.
        /// </summary>
        /// <param name="authorizationContextConfiguration">The <see cref="IAuthorizationContextConfiguration"/>.</param>
        /// <param name="queryfyDotNet">An instance of <see cref="IQueryfyDotNet"/>.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="authorizationContextConfiguration"/>' and '<paramref name="queryfyDotNet"/>' cannot be null. </exception>
        public OAuth2EndpointBuilder([NotNull] IAuthorizationContextConfiguration authorizationContextConfiguration, [NotNull] IQueryfyDotNet queryfyDotNet)
        {
            if (authorizationContextConfiguration == null)
            {
                throw new ArgumentNullException(nameof(authorizationContextConfiguration));
            }

            if (queryfyDotNet == null)
            {
                throw new ArgumentNullException(nameof(queryfyDotNet));
            }

            this.authorizationContextConfiguration = authorizationContextConfiguration;
            this.queryfyDotNet = queryfyDotNet;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AuthorizationHandler"/> class.
        /// </summary>
        /// <param name="authorizationContextConfiguration">The <see cref="IAuthorizationContextConfiguration"/>.</param>
        /// <param name="queryfyDotNet">The <see cref="IQueryfyDotNet"/>.</param>
        /// <param name="httpClient">The <see cref="HttpClient"/>.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="httpClient"/>', '<paramref name="authorizationContextConfiguration"/>' and '<paramref name="queryfyDotNet"/>' cannot be null. </exception>
        protected AuthorizationHandler([NotNull] IAuthorizationContextConfiguration authorizationContextConfiguration, [NotNull] IQueryfyDotNet queryfyDotNet, [NotNull] HttpClient httpClient)
        {
            if (authorizationContextConfiguration == null)
            {
                throw new ArgumentNullException(nameof(authorizationContextConfiguration));
            }

            if (queryfyDotNet == null)
            {
                throw new ArgumentNullException(nameof(queryfyDotNet));
            }

            if (httpClient == null)
            {
                throw new ArgumentNullException(nameof(httpClient));
            }

            this.AuthorizationContextConfiguration = authorizationContextConfiguration;
            this.QueryfyDotNet = queryfyDotNet;
            this.HttpClient    = httpClient;
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GoogleAuthorizationContext"/> class.
 /// </summary>
 /// <param name="kernel">The kernel.</param>
 /// <param name="authorizationStore">The <see cref="IAuthorizationStore"/>.</param>
 /// <param name="authorizationHandler">The <see cref="IAuthorizationHandler"/>.</param>
 /// <param name="authorizationContextConfiguration">The <see cref="IAuthorizationContextConfiguration"/>.</param>
 /// <exception cref="ArgumentNullException">The value of '<paramref name="kernel" />', '<paramref name="authorizationHandler" />', '<paramref name="authorizationStore" />' and '<paramref name="authorizationContextConfiguration" />' cannot be null. </exception>
 public GoogleAuthorizationContext([NotNull] IKernel kernel, [NotNull] IAuthorizationStore authorizationStore, [NotNull] IAuthorizationHandler authorizationHandler, [NotNull] IAuthorizationContextConfiguration authorizationContextConfiguration)
     : base(kernel, authorizationStore, authorizationHandler, authorizationContextConfiguration)
 {
 }