1
私はIdentity Server 4を使用しているAPIを持っています。しかし、私が[Authorized]
で守っているものは私に404
とAuthorizationヘッダーを付けてもらえません。私が経路から[Authorized]
を取り除くと、それは正しく当たってしまいます。何が問題なのでしょうか?C#.Net Core API Identity Server 4で許可されたルート
これはコントローラである:、
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace Security.API.Controllers
{
[Route("[controller]")]
public class AccountController : Controller
{
private readonly IAccountService accountService;
public AccountController(IAccountService accountService)
{
this.accountService = accountService;
}
[HttpGet("")]
public string Get()
{
return "You are seeing this because account controller is working fine!";
}
[Authorize]
[HttpGet("getauthorized")]
public string GetAuthorized()
{
return "This is authorized okay.";
}
...
まずルートのが打撃を受ける二番目は、あなたが証明書利用者の[オーソライズ]属性を配置する必要があり
これは将来的にそうなるはずですが、これはテスト目的のものです。ルートはとにかく打つべきではありませんか?私は、ルートがクライアントかサーバーかを知らないので、私が指定したリクエストに耳を傾けています:) – Norgul
実際には、ミドルウェアをクライアントまたはWeb API – JayDeeEss