Developing Authentication and Roles thinking about API

G

Giammarco

Hi all,

I'm developing an ASP.NET website and thinking about releasing the API
through webservices in a couple of months (like flickr.com let's say).

Most of the website functionality is restricted to authenticated users.
Users are classified in different roles, and different roles can take
different actions.

E.g. Guest can call a function to delete one of his articles, but
cannot call a function that can delete any article (which can be called
by an Administrator).

I would like to ask how would you handle user authentication and roles,
considering that I have to release the API?

The following is an example of the parameters I need to pass to a
"DeleteArticle" function called from a asp.net page that is accessible
only to authenticated users.

public bool DeleteArticle(articleID, UserID)
{
// delete article
}

The same function called from the API, could look like this if
authentication and roles are not planned with the webservices in mind.

public bool DeleteArticle(articleID, userID, userPassword)
{
// check username and password and authenticate
// check if user can delete article
// delete article
}

Thanks in advance,
Giammarco
 
G

Guest

Read up on "code access security". Rather than accepting authentication and
authorization information via your API, demand appropriate permissions inside
your implementation and let the Framework implement the security for you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top