خرید بک لینک

Vote count: 1

I am very new to what i am currently working now. I may not be explain well but as much i have understood i would like to put my understanding on the same.

I am using the Owin token based authentication for web api, for login i am calling the token method which retus the access token. I would like to know how to secure our web api, so that without the access token it should allow to call the web api method. I am using the angular js resource, i believe we need to define the header in angularjs service part, but where and exactly i do not have any idea, can anyone please help me on this.

Example:-

This my service written in angularjs,

sghServices.factory('GlobalSettingsService', function ($resource) {
retu $resource("../Api/eClaim/SecondGlobalSettings",
    {},
    {
        post: {
            method: 'POST', isArray: false,
            headers: { 'Content-Type': 'application/json' }
        },
        update: {
            method: 'PUT'
        }
    });
});

This is web api method

[Authorize]        
[Route("~/Api/eClaim/GlobalSettings")]
[HttpGet]
public ReportAndeCliam GetGlobalSettings()
{
    //Code Wriiten here
}

As of now i am able to access the web api without access token, i waa design in such a way if token is not available it should not allow to use the [Authorized] web api method.

Thanks in Advance :)

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 31 خرداد 1395 ساعت: 11:35

صفحه بندی