コード例 #1
0
        public async Task UpdateSettingsAsync(MicrosoftAccountSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            var container = await _siteService.LoadSiteSettingsAsync();

            container.Alter <MicrosoftAccountSettings>(nameof(MicrosoftAccountSettings), aspect =>
            {
                aspect.AppId        = settings.AppId;
                aspect.AppSecret    = settings.AppSecret;
                aspect.CallbackPath = settings.CallbackPath;
            });
            await _siteService.UpdateSiteSettingsAsync(container);
        }
コード例 #2
0
        public IEnumerable <ValidationResult> ValidateSettings(MicrosoftAccountSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (string.IsNullOrWhiteSpace(settings.AppId))
            {
                yield return(new ValidationResult(S["AppId is required"], new string[] { nameof(settings.AppId) }));
            }

            if (string.IsNullOrWhiteSpace(settings.AppSecret))
            {
                yield return(new ValidationResult(S["AppSecret is required"], new string[] { nameof(settings.AppSecret) }));
            }
        }
コード例 #3
0
 public UserInfoService(HttpClient http, IHttpContextAccessor httpContext, IOptions <MicrosoftAccountSettings> options)
 {
     this.http        = http;
     this.httpContext = httpContext;
     this.settings    = options.Value;
 }