Use new Auth API (#811)

This commit is contained in:
Hao Kung 2017-07-03 11:53:33 -07:00 committed by GitHub
parent 669c1755a8
commit cc283f7b4c
2 changed files with 14 additions and 20 deletions

View File

@ -94,7 +94,8 @@ namespace MusicStore
options.AddPolicy("ManageStore", new AuthorizationPolicyBuilder().RequireClaim("ManageStore", "Allowed").Build());
});
services.AddFacebookAuthentication(options =>
services.AddAuthentication()
.AddFacebook(options =>
{
options.AppId = "[AppId]";
options.AppSecret = "[AppSecret]";
@ -109,9 +110,7 @@ namespace MusicStore
options.Scope.Add("email");
options.Scope.Add("read_friendlists");
options.Scope.Add("user_checkins");
});
services.AddGoogleAuthentication(options =>
}).AddGoogle(options =>
{
options.ClientId = "[ClientId]";
options.ClientSecret = "[ClientSecret]";
@ -124,9 +123,7 @@ namespace MusicStore
};
options.StateDataFormat = new CustomStateDataFormat();
options.BackchannelHttpHandler = new GoogleMockBackChannelHttpHandler();
});
services.AddTwitterAuthentication(options =>
}).AddTwitter(options =>
{
options.ConsumerKey = "[ConsumerKey]";
options.ConsumerSecret = "[ConsumerSecret]";
@ -138,9 +135,7 @@ namespace MusicStore
};
options.StateDataFormat = new CustomTwitterStateDataFormat();
options.BackchannelHttpHandler = new TwitterMockBackChannelHttpHandler();
});
services.AddMicrosoftAccountAuthentication(options =>
}).AddMicrosoftAccount(options =>
{
options.ClientId = "[ClientId]";
options.ClientSecret = "[ClientSecret]";

View File

@ -89,24 +89,23 @@ namespace MusicStore
});
});
services.AddFacebookAuthentication(options =>
services.AddAuthentication()
.AddFacebook(options =>
{
options.AppId = "550624398330273";
options.AppSecret = "10e56a291d6b618da61b1e0dae3a8954";
});
services.AddGoogleAuthentication(options =>
})
.AddGoogle(options =>
{
options.ClientId = "995291875932-0rt7417v5baevqrno24kv332b7d6d30a.apps.googleusercontent.com";
options.ClientSecret = "J_AT57H5KH_ItmMdu0r6PfXm";
});
services.AddTwitterAuthentication(options =>
})
.AddTwitter(options =>
{
options.ConsumerKey = "lDSPIu480ocnXYZ9DumGCDw37";
options.ConsumerSecret = "fpo0oWRNc3vsZKlZSq1PyOSoeXlJd7NnG4Rfc94xbFXsdcc3nH";
});
})
// The MicrosoftAccount service has restrictions that prevent the use of
// http://localhost:5001/ for test applications.
// As such, here is how to change this sample to uses http://ktesting.com:5001/ instead.
@ -121,7 +120,7 @@ namespace MusicStore
// The sample app can then be run via:
// dnx . web
services.AddMicrosoftAccountAuthentication(options =>
.AddMicrosoftAccount(options =>
{
// MicrosoftAccount requires project changes
options.ClientId = "000000004012C08A";