Web API Basic Authorization

Salah satu alternatif untuk mengamankan Web API adalah dengan Basic Authorization.

Jika kita sudah menyiapkan sesuai petunjuk pada referensi [1], berikutnya kita tinggal menambahkan tag [Authorize] pada Web API Controller.

[code language=”csharp”]
[Authorize]
public class OperationController : ApiController
{
//…
}
[/code]

Setting Basic Authorization pada DHC.

Klik “set an authorization”

Capture

Isi username dan password

Capture

[1] http://www.piotrwalat.net/basic-http-authentication-in-asp-net-web-api-using-message-handlers/

Chandra Oemaryadi has written 244 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>