Ejemplo n.º 1
0
 public async Task<IActionResult> Create([FromForm]MyCustomDto myDto)
 {
     var authorizationResult = await _authorizationService.AuthorizeAsync(User, myDto, "MyCustomPolicy");
     if (!authorizationResult.Succeeded)
         return User.Identity.IsAuthenticated ? Forbid() : (IActionResult)Challenge();
     // Do some stuff here
 }
    public async Task <IActionResult> Create([FromForm] MyCustomDto myDto)
    {
        await _authorizationService.AuthorizeAsync(User, myDto, "MyCustomPolicy");

        // Do some stuff here
    }