Ejemplo n.º 1
0
        //public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        //{
        //    app.Map("/SpotifyChangeControl", map => Configure1(map, env, loggerFactory));
        //}

        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            //Setup Routes

            //Setup Auth
            //BEGIN RJB 9/10/2016
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage(); //ADDED THIS TO HAVE EXCEPTION PAGES INT MY APP WHEN IT IS IN DEBUG MODE ONLY
            }
            else //WHEN NOT IN DEBUG THEN HAVE SOMETHING COOLER
            {
                app.UseExceptionHandler("/Errors");
                app.UseStatusCodePagesWithRedirects("~/Errors/GetCustomErrorPageToMakeTheStupidHumanFeelGoodAboutThereTecnicalAbilitiesAndReassureThemItsNotTheirFault?sHttpStatus={0}");
                //app.UseStatusCodePagesWithReExecute("/Errors/GetCustomErrorPageToMakeTheStupidHumanFeelGoodAboutThereTecnicalAbilitiesAndReassureThemItsNotTheirFault?sHttpStatus={0}");
            }
            //END RJB 9/10/2016

            app.UseStaticFiles();

            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AutomaticAuthenticate = true,
                AutomaticChallenge    = true,
                AccessDeniedPath      = new PathString("/Account/Forbidden/"),
                LoginPath             = new PathString("/Account/Login/"),
                LogoutPath            = new PathString("/Account/Logout/")
            });

            SpotifyChangeControlLib.SCCManager oSCCManager = new SpotifyChangeControlLib.SCCManager();
            var Options = new AspNet.Security.OAuth.Spotify.SpotifyAuthenticationOptions()
            {
                ClientId     = oSCCManager.SCC_PUBLIC_ID,
                ClientSecret = oSCCManager.SCC_PRIVATE_ID,
            };

            Options.Scope.Add("playlist-read-private");
            Options.Scope.Add("user-read-private");
            Options.Scope.Add("user-read-email");
            Options.Scope.Add("user-library-read");
            Options.Scope.Add("user-follow-read");
            app.UseSpotifyAuthentication(Options);


            app.UseMvc();
        }
Ejemplo n.º 2
0
        //public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        //{
        //    app.Map("/SpotifyChangeControl", map => Configure1(map, env, loggerFactory));
        //}
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            //Setup Routes

            //Setup Auth
            //BEGIN RJB 9/10/2016
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage(); //ADDED THIS TO HAVE EXCEPTION PAGES INT MY APP WHEN IT IS IN DEBUG MODE ONLY
            }
            else //WHEN NOT IN DEBUG THEN HAVE SOMETHING COOLER
            {
                app.UseExceptionHandler("/Errors");
               app.UseStatusCodePagesWithRedirects("~/Errors/GetCustomErrorPageToMakeTheStupidHumanFeelGoodAboutThereTecnicalAbilitiesAndReassureThemItsNotTheirFault?sHttpStatus={0}");
               //app.UseStatusCodePagesWithReExecute("/Errors/GetCustomErrorPageToMakeTheStupidHumanFeelGoodAboutThereTecnicalAbilitiesAndReassureThemItsNotTheirFault?sHttpStatus={0}");
            }
            //END RJB 9/10/2016

            app.UseStaticFiles();

            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AutomaticAuthenticate = true,
                AutomaticChallenge = true,
                AccessDeniedPath = new PathString("/Account/Forbidden/"),
                LoginPath = new PathString("/Account/Login/"),
                LogoutPath = new PathString("/Account/Logout/")
            });

            SpotifyChangeControlLib.SCCManager oSCCManager = new SpotifyChangeControlLib.SCCManager();
            var Options = new AspNet.Security.OAuth.Spotify.SpotifyAuthenticationOptions()
            {
                ClientId = oSCCManager.SCC_PUBLIC_ID,
                ClientSecret = oSCCManager.SCC_PRIVATE_ID,

            };

            Options.Scope.Add("playlist-read-private");
            Options.Scope.Add("user-read-private");
            Options.Scope.Add("user-read-email");
            Options.Scope.Add("user-library-read");
            Options.Scope.Add("user-follow-read");
            app.UseSpotifyAuthentication(Options);

            app.UseMvc();
        }