Reputation: 1
I am making an application in android. How to do role authorisation in android. is there any package. please let me know.
Thanks, NVN
Upvotes: 0
Views: 2573
Reputation: 34150
I never used the Authenticator class. But if you plan to role your own authentication system, its pretty simple. Here are some tips:
Let me know if you need any other help.
Edit:
There isn't a library out there does this for you. You have to create a class called Token or User:
class Token{
String token;
Role role;
User user;
}
Role can be an enum like enum Role{admin, publisher, writer, reader,...}
.
Then let's say you authenticate against https://foobar.com/REST/authenticate/?user=foo&password=...
Which returns a simple JSON or XML (I suggest JSON)
{
token: "12345667",
role : "publisher",
user : { userId : "amir", ...}
}
So now you make an HTTPS call and authenticate against a user and password. Then parse the json and create a Token object. Store this token object in the app and you should have everything you need.
Upvotes: 1
Reputation: 272
Have you looked at the default Authenticator class? Here's the API from Google I hope that helps. =]
Upvotes: 0