質問

私はサイト全体のSSLを持つASP.NET MVC 3サイトを持っています。 ユーザー名とパスワードを受け入れ、Web Applicationsで他のアクションを呼び出すためのユーザーであるトークンを返すコントローラにログインアクションがあります。アクションがREST APIを呼び出します。

有効なユーザーが私のウェブサイトに行き、ログインし、その後トークンを抽出するようにすることができないことを確認できますか? その後彼はそのトークンを使って悪意のあるものを使って私のREST APIを呼び出すことができるでしょう...

役に立ちましたか?

解決

How can I be sure that valid user will not go to my website, login and after that use Fiddler to extract Token?

You cannot. But that's the whole point of user authentication and authorization. You use authentication to identify your user (after him providing a username and password) and give him a token (authentication cookie) that will be used later to access your API.

You use authorization to restrict what the user can do with this token. For example you can say that only logged in users that belong to the Administrators group could access a given controller action:

[Authorize(Roles = "Admin")]
public ActionResult SuperSecret()
{
    ...
}

Now even if a user is logged in and posses an authentication token he won't be able to access this controller action unless he belongs to the Administrators group.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top