Пример #1
0
        public OneDriveAccountServiceProvider(OneDriveUser user)
        {
            this.user = user;

            Uri baseUrl;

            if (!Uri.TryCreate(user.OneDriveBaseUrl, UriKind.Absolute, out baseUrl))
            {
                throw new InvalidOperationException("Unable to parse base URL: " + user.OneDriveBaseUrl);
            }

            this.resource     = string.Concat(baseUrl.Scheme, "://", baseUrl.Host);
            this.authProvider = new DelegateAuthenticationProvider(new DelegateAuthenticationProvider.ProviderAuthHeaderDelegate(async req =>
            {
                req.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", await this.user.GetAccessTokenAsync(this.resource));
            }));
        }
Пример #2
0
 public static void RegisterUser(string userGuid, OneDriveUser user)
 {
     KnownUsers[userGuid] = user;
 }