|
|
@ -124,14 +124,16 @@ namespace Mvc.Server { |
|
|
// Note: to support the password grant type, you must provide your own token endpoint action:
|
|
|
// Note: to support the password grant type, you must provide your own token endpoint action:
|
|
|
|
|
|
|
|
|
// [HttpPost("~/connect/token")]
|
|
|
// [HttpPost("~/connect/token")]
|
|
|
|
|
|
// [Produces("application/json")]
|
|
|
// public async Task<IActionResult> Exchange() {
|
|
|
// public async Task<IActionResult> Exchange() {
|
|
|
// var request = HttpContext.GetOpenIdConnectRequest();
|
|
|
// var request = HttpContext.GetOpenIdConnectRequest();
|
|
|
//
|
|
|
//
|
|
|
// if (request.IsPasswordGrantType()) {
|
|
|
// if (request.IsPasswordGrantType()) {
|
|
|
// var user = await _userManager.FindByNameAsync(request.Username);
|
|
|
// var user = await _userManager.FindByNameAsync(request.Username);
|
|
|
// if (user == null) {
|
|
|
// if (user == null) {
|
|
|
// return Json(new OpenIdConnectResponse {
|
|
|
// return BadRequest(new OpenIdConnectResponse {
|
|
|
// Error = OpenIdConnectConstants.Errors.InvalidGrant
|
|
|
// Error = OpenIdConnectConstants.Errors.InvalidGrant,
|
|
|
|
|
|
// ErrorDescription = "The username/password couple is invalid."
|
|
|
// });
|
|
|
// });
|
|
|
// }
|
|
|
// }
|
|
|
//
|
|
|
//
|
|
|
@ -141,8 +143,9 @@ namespace Mvc.Server { |
|
|
// await _userManager.AccessFailedAsync(user);
|
|
|
// await _userManager.AccessFailedAsync(user);
|
|
|
// }
|
|
|
// }
|
|
|
//
|
|
|
//
|
|
|
// return Json(new OpenIdConnectResponse {
|
|
|
// return BadRequest(new OpenIdConnectResponse {
|
|
|
// Error = OpenIdConnectConstants.Errors.InvalidGrant
|
|
|
// Error = OpenIdConnectConstants.Errors.InvalidGrant,
|
|
|
|
|
|
// ErrorDescription = "The username/password couple is invalid."
|
|
|
// });
|
|
|
// });
|
|
|
// }
|
|
|
// }
|
|
|
//
|
|
|
//
|
|
|
@ -164,8 +167,9 @@ namespace Mvc.Server { |
|
|
// return SignIn(ticket.Principal, ticket.Properties, ticket.AuthenticationScheme);
|
|
|
// return SignIn(ticket.Principal, ticket.Properties, ticket.AuthenticationScheme);
|
|
|
// }
|
|
|
// }
|
|
|
//
|
|
|
//
|
|
|
// return Json(new OpenIdConnectResponse {
|
|
|
// return BadRequest(new OpenIdConnectResponse {
|
|
|
// Error = OpenIdConnectConstants.Errors.UnsupportedGrantType
|
|
|
// Error = OpenIdConnectConstants.Errors.UnsupportedGrantType,
|
|
|
|
|
|
// ErrorDescription = "The specified grant type is not supported."
|
|
|
// });
|
|
|
// });
|
|
|
// }
|
|
|
// }
|
|
|
} |
|
|
} |
|
|
|