Java Client API LoginRequest problem withCheckSecurePassword

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

milindsh
Posts: 10
Joined: 03 Oct 2011, 21:15

Java Client API LoginRequest problem withCheckSecurePassword

Postby milindsh » 27 Oct 2011, 20:52

When i do (getApi().checkSecurePassword(session, "plainsignature", encrypted_pass)) in my LoginEventHandler, when the encrypted password is being sent from an ios client on loginrequest, checksecurepassword works but when i send a loginrequest from the java client api, the checksecurepassword always returns false even when the correct cleartext password is supplied. Is the java client api deprecated. Is this some known issue in the java client api?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 01 Nov 2011, 19:39

Thanks for reporting, we'll look into this soon and let you know
Lapo
--
gotoAndPlay()
...addicted to flash games
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 03 Nov 2011, 10:01

Taking a peek now!

/T
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
milindsh
Posts: 10
Joined: 03 Oct 2011, 21:15

Status update

Postby milindsh » 12 Dec 2011, 21:08

Any luck so far? Can you confirm that you are able to reproduce the bug?


Lapo wrote:Thanks for reporting, we'll look into this soon and let you know
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 15 Dec 2011, 10:35

Sorry for the late reply.

No - I have not been able to reproduce this. My test code works as expected.

Here are some code snippets:

Extension:

Code: Select all

   String name = (String) event.getParameter(SFSEventParam.LOGIN_NAME);
      String pwd = (String) event.getParameter(SFSEventParam.LOGIN_PASSWORD);

      if (getApi().checkSecurePassword(session, "test", pwd)) {
         trace("Password test recognized");
      } else {
         trace("Password test NOT recognized");
      }


Client code:

Code: Select all

            sfs.send(new LoginRequest("testuser", "test", zone));


Server console:

Code: Select all

11:35:33,091 INFO  [SocketReader] core.SocketAcceptor     - Session created: { Id: 6, Type: DEFAULT, Logged: No, IP: 127.0.0.1:59305 } on Server port: 9933 <---> 59305
11:35:33,211 INFO  [pool-1-thread-1] Extensions     - {heroesRUs}: Password test recognized
11:35:33,286 INFO  [pool-1-thread-1] Extensions     - {heroesRUs}: No user found with username testuser
11:35:33,286 WARN  [pool-1-thread-1] managers.SFSExtensionManager     - com.smartfoxserver.v2.exceptions.SFSLoginException: No user found with username testuser
11:35:57,365 INFO  [Scheduler1-thread-1] sessions.DefaultSessionManager     - Session removed: { Id: 6, Type: DEFAULT, Logged: No, IP: 127.0.0.1:59305 }


If I change the password in the client to something that is not "test", then the extension correctly writes

Code: Select all

11:35:16,930 INFO  [SocketReader] core.SocketAcceptor     - Session created: { Id: 5, Type: DEFAULT, Logged: No, IP: 127.0.0.1:59302 } on Server port: 9933 <---> 59302
11:35:17,200 INFO  [pool-1-thread-1] Extensions     - {heroesRUs}: Password test NOT recognized
11:35:17,288 INFO  [pool-1-thread-1] Extensions     - {heroesRUs}: No user found with username testuser
11:35:17,288 WARN  [pool-1-thread-1] managers.SFSExtensionManager     - com.smartfoxserver.v2.exceptions.SFSLoginException: No user found with username testuser


Can you give some more info?

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games

Follow on twitter: http://twitter.com/thomas_h_lund
milindsh
Posts: 10
Joined: 03 Oct 2011, 21:15

Checksecurepassword for java client not working

Postby milindsh » 19 Dec 2011, 20:02

I have tried the exact same thing and my checksecurepassword does not work for correct passwords. I tried updating to the latest sfs2x rc3 but it still does not work.



ThomasLund wrote:Sorry for the late reply.

No - I have not been able to reproduce this. My test code works as expected.

Here are some code snippets:

Extension:

Code: Select all

   String name = (String) event.getParameter(SFSEventParam.LOGIN_NAME);
      String pwd = (String) event.getParameter(SFSEventParam.LOGIN_PASSWORD);

      if (getApi().checkSecurePassword(session, "test", pwd)) {
         trace("Password test recognized");
      } else {
         trace("Password test NOT recognized");
      }


Client code:

Code: Select all

            sfs.send(new LoginRequest("testuser", "test", zone));


Server console:

Code: Select all

11:35:33,091 INFO  [SocketReader] core.SocketAcceptor     - Session created: { Id: 6, Type: DEFAULT, Logged: No, IP: 127.0.0.1:59305 } on Server port: 9933 <---> 59305
11:35:33,211 INFO  [pool-1-thread-1] Extensions     - {heroesRUs}: Password test recognized
11:35:33,286 INFO  [pool-1-thread-1] Extensions     - {heroesRUs}: No user found with username testuser
11:35:33,286 WARN  [pool-1-thread-1] managers.SFSExtensionManager     - com.smartfoxserver.v2.exceptions.SFSLoginException: No user found with username testuser
11:35:57,365 INFO  [Scheduler1-thread-1] sessions.DefaultSessionManager     - Session removed: { Id: 6, Type: DEFAULT, Logged: No, IP: 127.0.0.1:59305 }


If I change the password in the client to something that is not "test", then the extension correctly writes

Code: Select all

11:35:16,930 INFO  [SocketReader] core.SocketAcceptor     - Session created: { Id: 5, Type: DEFAULT, Logged: No, IP: 127.0.0.1:59302 } on Server port: 9933 <---> 59302
11:35:17,200 INFO  [pool-1-thread-1] Extensions     - {heroesRUs}: Password test NOT recognized
11:35:17,288 INFO  [pool-1-thread-1] Extensions     - {heroesRUs}: No user found with username testuser
11:35:17,288 WARN  [pool-1-thread-1] managers.SFSExtensionManager     - com.smartfoxserver.v2.exceptions.SFSLoginException: No user found with username testuser


Can you give some more info?

/Thomas
jono
Posts: 8
Joined: 11 Oct 2011, 01:38

Me too

Postby jono » 19 Dec 2011, 20:17

I'm experiencing the same problem as milindsh.
The test case is nearly identical to what Thomas outlined.
I send login request using the Java client api:

Code: Select all

sfs.send(new LoginRequest("testuser","test","TestZone"));


In my extension's LoginEventHandler, I hardcode the password to check against to "test":

Code: Select all

if (getApi().checkSecurePassword(session, "test", encrypted_pass)){
             trace("yay logged in ");
          }
else {
    //do failure stuff
}


Can SFS admins/staff give us a hand in figuring out what's going wrong? What additional information can we provide? Strangely, the server side code works just fine when tested with requests coming from the iOS client api so clearly there's an issue with my setup or with the Java client api.
jono
Posts: 8
Joined: 11 Oct 2011, 01:38

me too, 2

Postby jono » 19 Dec 2011, 20:22

Code: Select all

14:08:15,197 INFO  [pool-1-thread-2] Extensions     - {TestExtension}: Password does not match
14:08:15,198 WARN  [pool-1-thread-2] managers.SFSExtensionManager     - com.smartfoxserver.v2.exceptions.SFSLoginException: Authentication Failed
14:08:41,801 INFO  [Scheduler1-thread-1] sessions.DefaultSessionManager     - Session removed: { Id: 4, Type: DEFAULT, Logged: No, IP: 10.10.6.16:44611 }
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 20 Dec 2011, 08:33

Interesting....!

What API jar did you guys use? Latest released here on the forums?

/T
Full Control - maker of Unity/C# and Java SFS API and indie games

Follow on twitter: http://twitter.com/thomas_h_lund
milindsh
Posts: 10
Joined: 03 Oct 2011, 21:15

Postby milindsh » 20 Dec 2011, 17:28

The SmartFoxServer 2X Release Candidate 3 and before that Smartfoxserver2x..and the client api associated with it. My suspicion is that the client api for java is messing up and the server code is working fine..since the ios encrypted password works for checksecurepoassword but the encrypted password for java does not work.


ThomasLund wrote:Interesting....!

What API jar did you guys use? Latest released here on the forums?

/T
jono
Posts: 8
Joined: 11 Oct 2011, 01:38

Me too, 3

Postby jono » 20 Dec 2011, 17:41

Not sure that it's relevant/helpful, but I'll add that we're not using the Java Client API in the context of an Android simulator, or device.

Maybe the client Login API makes use of some different encryption library in that context?

I'll check it out.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 20 Dec 2011, 21:03

My test is from a java console project - not Android or simulator. Running on OSX.

I've tested the same code also with the C# client - and it works there too. Simply not reproducing the error.

The jar I use is the one linked here:

http://fullcontrol.dk/downloads/SFS2X/SFS2X_JavaAPI.jar

Could you give it a go and report back?

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games

Follow on twitter: http://twitter.com/thomas_h_lund
KSops
Posts: 5
Joined: 02 Jul 2012, 06:53

Re: Java Client API LoginRequest problem withCheckSecurePass

Postby KSops » 02 Jul 2012, 07:13

The linked jar (http://fullcontrol.dk/downloads/SFS2X/SFS2X_JavaAPI.jar ) no longer exists.
I'm currently running into this problem as well where, by using a hardcoded password value "test" server-side:

getApi().checkSecurePassword(session, "test", password)

and using:

sfs.send( new LoginRequest("test", "test", "testZone") );

in the java client (JDK1.6.0_33).

I get a return falue of false no matter what I try. Are there some steps that can be taken to investigate from the community?
It seems so confusing because I assume many other users are probably fine with the password checking, so surely this must be some kind of configuration problem? :\
We ran into a Java String encoding problem earlier in a company project involving default locales, byte representations, etc. So if the hash method is being affected by that perhaps?
I hope I can get past this problem, login is rather important >.<
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Java Client API LoginRequest problem withCheckSecurePass

Postby rjgtav » 02 Jul 2012, 10:20

Hello.
Are you running the latest Java Client API and latest server patch (2.1.0)? You can get the from:
http://www.smartfoxserver.com/download/sfs2x#p=updates
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
KSops
Posts: 5
Joined: 02 Jul 2012, 06:53

Re: Java Client API LoginRequest problem withCheckSecurePass

Postby KSops » 02 Jul 2012, 16:34

Oh! Sorry!
I assumed since I downloaded from the main site that it was the most recent version. I've just started developing with SmartfoxServer2X this past two weeks.
I'm really excited about it! Let me try with the latest and see if the problem persists. Thank you!

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 12 guests