Exemple #1
0
        // This method gets called by a runtime.
        // Use this method to add services to the container
        public void ConfigureServices(IServiceCollection services)
        {
            // Configure the options for the authentication middleware.
            // You can add options for Google, Twitter and other middleware as shown below.
            // For more information see http://go.microsoft.com/fwlink/?LinkID=532715

            /*services.Configure<FacebookAuthenticationOptions>(options =>
             * {
             *  options.AppId = Configuration["Authentication:Facebook:AppId"];
             *  options.AppSecret = Configuration["Authentication:Facebook:AppSecret"];
             * });
             *
             * services.Configure<MicrosoftAccountAuthenticationOptions>(options =>
             * {
             *  options.ClientId = Configuration["Authentication:MicrosoftAccount:ClientId"];
             *  options.ClientSecret = Configuration["Authentication:MicrosoftAccount:ClientSecret"];
             * });*/

            // Register application services.

            string connectionString;

            Configuration.TryGet("MicrosoftAzureStorage:ConnectionString", out connectionString);
            var context = new CloudContext(connectionString);

            string blobContainer;

            Configuration.TryGet("MicrosoftAzureStorage:BlobContainer", out blobContainer);
            var blobStorage = new MediaStorageRepository(blobContainer, context);

            services.AddSingleton <CloudContext, CloudContext>().AddInstance(context);
            services.AddSingleton <MediaStorageRepository, MediaStorageRepository>().AddInstance(blobStorage);
            services.AddSingleton <UserRepository, UserRepository>();
            services.AddSingleton <AccountRepository, AccountRepository>();
            services.AddSingleton <MomentRepository, MomentRepository>();

            services.AddTransient <IUserClaimsPrincipalFactory <User>, UserClaimsPrincipalFactory>();
            services.AddSingleton <IdentityErrorDescriber, IdentityErrorDescriber>();
            services.AddTransient <ILookupNormalizer, LookupNormalizer>();
            services.AddTransient <IPasswordHasher <User>, ClearPassword>();
            services.AddSingleton <IUserStore <User>, CustomUserStore>();
            services.AddTransient <UserManager <User>, UserManager <User> >();

            services.AddTransient <SignInManager <User>, SignInManager <User> >();

            /*
             * services.Configure<TwitterAuthenticationOptions>(options =>
             * {
             *  options.ConsumerKey = "Authentication:TwitterAccount:ConsumerKey";
             *  options.ConsumerSecret = "Authentication:TwitterAccount:ConsumerSecret";
             *  options.SignInScheme = new TwitterAuthenticationOptions().SignInScheme;
             * });*/

            // Add MVC services to the services container.
            services.AddMvc();

            // Uncomment the following line to add Web API services which makes it easier to port Web API 2 controllers.
            // You will also need to add the Microsoft.AspNet.Mvc.WebApiCompatShim package to the 'dependencies' section of project.json.
            // services.AddWebApiConventions();
        }
Exemple #2
0
        protected RepositoryBase(string partitionKey, CloudContext context)
        {
            PartitionKey = partitionKey;
            Context      = context;

            _operations = new ConcurrentQueue <Tuple <ITableEntity, TableOperation> >();
        }
        public AccountController(UserManager<User> userManager, SignInManager<User> signInManager, CloudContext context, AccountRepository repository)
        {
            _userManager = userManager;
            _signInManager = signInManager;

            Repository = repository;
            CloudContext = context;
        }
 public MediaStorageRepository(string container, CloudContext context)
 {
     Container = container;
     Context = context;
 }
Exemple #5
0
 public FriendshipRepository(CloudContext context) : base("Friendship", context)
 {
 }
Exemple #6
0
 public UserRepository(CloudContext context) : base("User", context)
 {
 }
Exemple #7
0
 public AccountRepository(CloudContext context) : base("Account", context)
 {
 }
 public MomentsController(CloudContext context, MomentRepository repository, MediaStorageRepository mediaStorage)
 {
     Repository = repository;
     CloudContext = context;
     MediaStorage = mediaStorage;
 }
Exemple #9
0
 public MediaStorageRepository(string container, CloudContext context)
 {
     Container = container;
     Context   = context;
 }
Exemple #10
0
 public MomentRepository(CloudContext context) : base("Moment", context)
 {
 }