コード例 #1
0
        /// <summary>
        /// Initializes a new instance of EsiaClient class with options
        /// </summary>
        /// <param name="options">ESIA options class instance</param>
        public EsiaClient(EsiaOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            Options = options;

            // Options.ClientId must be provided
            if (String.IsNullOrWhiteSpace(Options.ClientId))
            {
                throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Resources.ErrorParamMustBeProvided, "ClientId"));
            }

            // Options.Scope must be provided
            if (String.IsNullOrWhiteSpace(Options.Scope))
            {
                throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Resources.ErrorParamMustBeProvided, "Scope"));
            }

            // Options.RequestType must be provided
            if (String.IsNullOrWhiteSpace(Options.RequestType))
            {
                throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Resources.ErrorParamMustBeProvided, "RequestType"));
            }

            // Options.SignProvider must be provided
            if (Options.SignProvider == null)
            {
                throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Resources.ErrorParamMustBeProvided, "SignProvider"));
            }
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of EsiaClient class with options and access token
        /// </summary>
        /// <param name="options">ESIA options class instance</param>
        /// <param name="token">Instance of EsiaToken class</param>
        public EsiaClient(EsiaOptions options, EsiaToken token) : this(options)
        {
            if (token == null)
            {
                throw new ArgumentNullException("token");
            }

            Token = token;
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of EsiaClient class with options and access token
 /// </summary>
 /// <param name="options">ESIA options class instance</param>
 /// <param name="accessToken">Access token</param>
 public EsiaClient(EsiaOptions options, string accessToken) : this(options, new EsiaToken(accessToken))
 {
 }