コード例 #1
0
        public MAuthRequestRetrier(MAuthOptionsBase options)
        {
            var signingHandler = new MAuthSigningHandler(options: new MAuthSigningOptions()
            {
                ApplicationUuid = options.ApplicationUuid,
                PrivateKey      = options.PrivateKey,
            },
                                                         innerHandler: options.MAuthServerHandler ?? new HttpClientHandler()
                                                         );

            client = new HttpClient(signingHandler)
            {
                Timeout = TimeSpan.FromSeconds(options.AuthenticateRequestTimeoutSeconds)
            };
        }
コード例 #2
0
        public MAuthAuthenticator(MAuthOptionsBase options, ILogger logger)
        {
            if (options.ApplicationUuid == default(Guid))
            {
                throw new ArgumentException(nameof(options.ApplicationUuid));
            }

            if (options.MAuthServiceUrl == null)
            {
                throw new ArgumentNullException(nameof(options.MAuthServiceUrl));
            }

            if (string.IsNullOrWhiteSpace(options.PrivateKey))
            {
                throw new ArgumentNullException(nameof(options.PrivateKey));
            }

            this.options = options;
            this.logger  = logger;
        }
コード例 #3
0
        public MAuthAuthenticator(MAuthOptionsBase options)
        {
            if (options.ApplicationUuid == default(Guid))
            {
                throw new ArgumentException(nameof(options.ApplicationUuid));
            }

            if (options.MAuthServiceUrl == null)
            {
                throw new ArgumentNullException(nameof(options.MAuthServiceUrl));
            }

            if (string.IsNullOrWhiteSpace(options.PrivateKey))
            {
                throw new ArgumentNullException(nameof(options.PrivateKey));
            }

            this.options = options;

            retrier = new MAuthRequestRetrier(options);
        }
コード例 #4
0
        public MAuthRequestRetrier(MAuthOptionsBase options)
        {
            var signingHandler = new MAuthSigningHandler(options: new MAuthSigningOptions()
            {
                ApplicationUuid = options.ApplicationUuid,
                PrivateKey      = options.PrivateKey
            },
                                                         innerHandler: options.MAuthServerHandler ??
#if NETSTANDARD1_4
                                                         new HttpClientHandler()
#else
                                                         new WebRequestHandler()
            {
                CachePolicy = new RequestCachePolicy(RequestCacheLevel.Default)
            }
#endif
                                                         );

            client         = new HttpClient(signingHandler);
            client.Timeout = TimeSpan.FromSeconds(options.AuthenticateRequestTimeoutSeconds);
        }