oidc reloaded

This commit is contained in:
2016-06-06 12:38:11 +02:00
parent adfaa1a587
commit c65985477e
22 changed files with 558 additions and 255 deletions

View File

@ -8,10 +8,10 @@ namespace Mvc.Client.Controllers {
public class AuthenticationController : Controller {
[HttpGet("~/signin")]
public ActionResult SignIn(string returnUrl) {
public ActionResult SignIn() {
// Instruct the OIDC client middleware to redirect the user agent to the identity provider.
// Note: the authenticationType parameter must match the value configured in Startup.cs
var properties = new AuthenticationProperties { RedirectUri = "/" };
var properties = new AuthenticationProperties { RedirectUri = "http://localhost:5002/signin-oidc" };
return new ChallengeResult(OpenIdConnectDefaults.AuthenticationScheme, properties);
}

View File

@ -69,22 +69,32 @@ namespace testOauthClient
LoginPath = new PathString("/signin"),
LogoutPath = new PathString("/signout")
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions {
RequireHttpsMetadata = false,
app.UseOpenIdConnectAuthentication(
options => {
options.AuthenticationScheme = OpenIdConnectDefaults.AuthenticationScheme;
options.RequireHttpsMetadata = false;
// Note: these settings must match the application details
// inserted in the database at the server level.
ClientId = "016c5ae4-f4cd-40e3-b250-13701c871ecd",
ClientSecret = "blahblah",
PostLogoutRedirectUri = "http://dev.pschneider.fr/",
options.ClientId = "016c5ae4-f4cd-40e3-b250-13701c871ecd";
options.ClientSecret = "blahblah";
options.PostLogoutRedirectUri = "http://dev.pschneider.fr/";
// Use the authorization code flow.
ResponseType = OpenIdConnectResponseTypes.Code,
options.ResponseType = OpenIdConnectResponseTypes.Code;
// Note: setting the Authority allows the OIDC client middleware to automatically
// retrieve the identity provider's configuration and spare you from setting
// the different endpoints URIs or the token validation parameters explicitly.
Authority = "http://dev.pschneider.fr/"
options.Authority = "http://dev.pschneider.fr/";
// Note: the resource property represents the different endpoints the
// access token should be issued for (values must be space-delimited).
options.Resource = "http://dev.pschneider.fr/";
// options.Scope.Add("api-resource-controller");
});

View File

@ -23,7 +23,7 @@
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel"
"web": "Microsoft.AspNet.Server.Kestrel --server.urls=http://*:5002"
},
"frameworks": {
"dnx451": {}