<commit_before>﻿using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth;
using DotNetOpenAuth.OAuth.ChannelElements;
using FloydPink.Flickr.Downloadr.OAuth;
using FloydPink.Flickr.Downloadr.OAuth.Listener;
using FloydPink.Flickr.Downloadr.Repository.Helpers;
using StructureMap.Configuration.DSL;

namespace FloydPink.Flickr.Downloadr.Bootstrap {
    public class OAuthRegistry : Registry {
        private const string SharedSecret = "kn98nkgg90sknka2038234(&9883!@%^";

        private const string ConsumerKey =
            "<KEY>;

        private const string ConsumerSecret = "<KEY>;

        private static readonly ServiceProviderDescription FlickrServiceDescription =
            new ServiceProviderDescription {
                ProtocolVersion = ProtocolVersion.V10a,
                RequestTokenEndpoint =
                    new MessageReceivingEndpoint("http://www.flickr.com/services/oauth/request_token",
                        HttpDeliveryMethods.PostRequest),
                UserAuthorizationEndpoint =
                    new MessageReceivingEndpoint("http://www.flickr.com/services/oauth/authorize",
                        HttpDeliveryMethods.GetRequest),
                AccessTokenEndpoint =
                    new MessageReceivingEndpoint("http://www.flickr.com/services/oauth/access_token",
                        HttpDeliveryMethods.GetRequest),
                TamperProtectionElements =
                    new ITamperProtectionChannelBindingElement [] {
                        new HmacSha1SigningBindingElement()
                    }
            };

        private static readonly MessageReceivingEndpoint FlickrServiceEndPoint =
            new MessageReceivingEndpoint("http://api.flickr.com/services/rest", HttpDeliveryMethods.PostRequest);

        public OAuthRegistry() {
            For<IOAuthManager>()
                .Singleton()
                //.EnrichAllWith(DynamicProxy.LoggingInterceptorFor<IOAuthManager>())
                .Use<OAuthManager>().
                 Ctor<MessageReceivingEndpoint>("serviceEndPoint").Is(FlickrServiceEndPoint);

            For<DesktopConsumer>()
                .Use<DesktopConsumer>()
                .Ctor<ServiceProviderDescription>("serviceDescription")
                .Is(FlickrServiceDescription);

            For<IConsumerTokenManager>()
                .Use<TokenManager>()
                .Ctor<string>("consumerKey")
                .Is(Crypt.Decrypt(ConsumerKey, SharedSecret))
                .Ctor<string>("consumerSecret")
                .Is(Crypt.Decrypt(ConsumerSecret, SharedSecret));

            For<IHttpListenerManager>()
                //.EnrichAllWith(DynamicProxy.LoggingInterceptorFor<IHttpListenerManager>())
                .Use<HttpListenerManager>();
        }
    }
}
<commit_msg>change to make the flickr api calls use https<commit_after>﻿using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth;
using DotNetOpenAuth.OAuth.ChannelElements;
using FloydPink.Flickr.Downloadr.OAuth;
using FloydPink.Flickr.Downloadr.OAuth.Listener;
using FloydPink.Flickr.Downloadr.Repository.Helpers;
using StructureMap.Configuration.DSL;

namespace FloydPink.Flickr.Downloadr.Bootstrap {
    public class OAuthRegistry : Registry {
        private const string SharedSecret = "kn98nkgg90sknka2038234(&9883!@%^";

        private const string ConsumerKey =
            "<KEY>;

        private const string ConsumerSecret = "<KEY>;

        private static readonly ServiceProviderDescription FlickrServiceDescription =
            new ServiceProviderDescription {
                ProtocolVersion = ProtocolVersion.V10a,
                RequestTokenEndpoint =
                    new MessageReceivingEndpoint("http://www.flickr.com/services/oauth/request_token",
                        HttpDeliveryMethods.PostRequest),
                UserAuthorizationEndpoint =
                    new MessageReceivingEndpoint("http://www.flickr.com/services/oauth/authorize",
                        HttpDeliveryMethods.GetRequest),
                AccessTokenEndpoint =
                    new MessageReceivingEndpoint("http://www.flickr.com/services/oauth/access_token",
                        HttpDeliveryMethods.GetRequest),
                TamperProtectionElements =
                    new ITamperProtectionChannelBindingElement [] {
                        new HmacSha1SigningBindingElement()
                    }
            };

        private static readonly MessageReceivingEndpoint FlickrServiceEndPoint =
			new MessageReceivingEndpoint("https://api.flickr.com/services/rest", HttpDeliveryMethods.PostRequest);

        public OAuthRegistry() {
            For<IOAuthManager>()
                .Singleton()
                //.EnrichAllWith(DynamicProxy.LoggingInterceptorFor<IOAuthManager>())
                .Use<OAuthManager>().
                 Ctor<MessageReceivingEndpoint>("serviceEndPoint").Is(FlickrServiceEndPoint);

            For<DesktopConsumer>()
                .Use<DesktopConsumer>()
                .Ctor<ServiceProviderDescription>("serviceDescription")
                .Is(FlickrServiceDescription);

            For<IConsumerTokenManager>()
                .Use<TokenManager>()
                .Ctor<string>("consumerKey")
                .Is(Crypt.Decrypt(ConsumerKey, SharedSecret))
                .Ctor<string>("consumerSecret")
                .Is(Crypt.Decrypt(ConsumerSecret, SharedSecret));

            For<IHttpListenerManager>()
                //.EnrichAllWith(DynamicProxy.LoggingInterceptorFor<IHttpListenerManager>())
                .Use<HttpListenerManager>();
        }
    }
}

{'fraction_non_alphanumeric': 0.08819345661450925, 'fraction_numerical': 0.006401137980085348, 'mean_word_length': 2.277972027972028, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 1, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3748599', 'n_tokens_mistral': 1490, 'n_tokens_neox': 1337, 'n_words': 190}