fixe l'impact OAuth sheme

This commit is contained in:
Paul Schneider 2016-06-10 03:00:24 +02:00
commit 494a840f70
4 changed files with 38 additions and 30 deletions

View file

@ -118,5 +118,22 @@ namespace Yavsc.WebApi.Controllers
base.Dispose(disposing);
}
[HttpGet("~/api/me"),Produces("application/json")]
public async Task<IActionResult> Me ()
{
if (User==null) return new BadRequestObjectResult(
new {
error = "no user"
});
var uid = User.GetUserId();
if (uid == null)
return new BadRequestObjectResult(
new {
error = "not identified"
});
return Ok(await UserManager.FindByIdAsync(uid));
}
}
}