Example #1
0
        public DropboxOAuthConsumer(int userId, IDropboxService dropboxService, IUserService userService)
        {
            var dropboxEnpoints = dropboxService.GetDroboxOAuthEndpoints();

            ServiceProviderDescription = new ServiceProviderDescription
            {
                RequestTokenEndpoint = new MessageReceivingEndpoint(dropboxEnpoints.RequestToken,
                                                HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.PostRequest),
                UserAuthorizationEndpoint = new MessageReceivingEndpoint(dropboxEnpoints.UserAuthorization,
                                                HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.GetRequest),
                AccessTokenEndpoint = new MessageReceivingEndpoint(dropboxEnpoints.AccessToken,
                                                HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.PostRequest),
                TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() },

                ProtocolVersion = ProtocolVersion.V10
            };

            WebConsumer = new WebConsumer(ServiceProviderDescription, new DropboxConsumerTokenManager(userId, dropboxService, userService));
        }