Forums

Home » Mobile » Liferay Mobile SDK

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Ouds CG
Android: how to get authentication info when I submit screename & password
May 9, 2014 8:04 AM
Answer

Ouds CG

Rank: New Member

Posts: 3

Join Date: May 9, 2014

Recent Posts

Hi, all,

In Liferay Android sdk: how to get authentication info when I submit screename & password.

I have read official document several times, I know that do in background in MyAsyncTask class that extends AsyncTask, for example,
 1
 2        Session session = SettingsUtil.getSession();
 3        UserService userService = new UserService(session);
 4       
 5        try {
 6            long groupId = getGuestGroupId(session);
 7                        ...
 8        }
 9        catch (Exception e) {
10            Log.e(_CLASS_NAME, "Couldn't get users", e);
11
12            _exception = e;
13
14            cancel(true);
15        }


but I want to get response info and judge to return something to user when I submit screenname and password, for example,
1
2        Session session = SettingsUtil.getSession();
3        UserService userService = new UserService(session);
4                ......
5                case "the screenname does not exist"
6                case "the password is incorrect"
7                case "the user is forbidden"
8                case .......


thank you very much
Bruno Farache
RE: Android: how to get authentication info when I submit screename & passw
May 10, 2014 4:36 AM
Answer

Bruno Farache

LIFERAY STAFF

Rank: Liferay Master

Posts: 584

Join Date: May 14, 2007

Recent Posts

Hi Ouds,

Ouds CG:

but I want to get response info and judge to return something to user when I submit screenname and password, for example,


When authentication fails it just returns a generic exception, it doesn't say the username doesn't exist or password doesn't match because this would be a security issue.

UserService has some methods to fetch users by email, username, userId, but those require authentication as well.
Ouds CG
RE: Android: how to get authentication info when I submit screename & passw
May 10, 2014 5:12 AM
Answer

Ouds CG

Rank: New Member

Posts: 3

Join Date: May 9, 2014

Recent Posts

Bruno Farache:
Hi Ouds,

Ouds CG:

but I want to get response info and judge to return something to user when I submit screenname and password, for example,


When authentication fails it just returns a generic exception, it doesn't say the username doesn't exist or password doesn't match because this would be a security issue.

UserService has some methods to fetch users by email, username, userId, but those require authentication as well.



hi, thank you very much for your reply.
Pier Paolo Ramon
R: Android: how to get authentication info when I submit screename & passwo
June 5, 2014 10:32 AM
Answer

Pier Paolo Ramon

Rank: Junior Member

Posts: 84

Join Date: May 25, 2010

Recent Posts

Could it be a good idea to port the authentication heuristic from liferay-connector to the Mobile SDK? It looks like a lot of people have trouble identifying the authenticating user’s details.

Sent from my iPhone with Liferay.com Forums
Pier Paolo Ramon
R: Android: how to get authentication info when I submit screename & passwo
June 5, 2014 5:45 PM
Answer

Pier Paolo Ramon

Rank: Junior Member

Posts: 84

Join Date: May 25, 2010

Recent Posts

…and with heuristic I mean the code you can find at
1getUser
here https://github.com/smclab/liferay-connector/blob/master/lib/connectors/liferay62.js

Sent from my iPhone with Liferay.com Forums
Bruno Farache
RE: R: Android: how to get authentication info when I submit screename & pa
June 6, 2014 6:54 AM
Answer

Bruno Farache

LIFERAY STAFF

Rank: Liferay Master

Posts: 584

Join Date: May 14, 2007

Recent Posts

Wondering if we could make these 3 requests in batch, instead of sending them separately. Created a ticket for that.
Bruno Farache
RE: R: Android: how to get authentication info when I submit screename & pa
June 6, 2014 7:00 AM
Answer

Bruno Farache

LIFERAY STAFF

Rank: Liferay Master

Posts: 584

Join Date: May 14, 2007

Recent Posts

A better solution would be to create a remote service that tells which authentication mechanism is being used. If it's by userId, email or screen name.
Pier Paolo Ramon
R: Android: how to get authentication info when I submit screename & passwo
June 6, 2014 7:20 AM
Answer

Pier Paolo Ramon

Rank: Junior Member

Posts: 84

Join Date: May 25, 2010

Recent Posts

1) that service would raise few security concerns probably but it would be awesome 2) if getByUserId fails it floods the log with stack traces that's why we made them sequentially emoticon

Sent from my iPhone with Liferay.com Forums