File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Best way for login authentication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Best way for login authentication" Watch "Best way for login authentication" New topic
Author

Best way for login authentication

James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282

I'm making a chat program and I want the user to have to login. I figure the username/password would be sent to the server where it will check a file to see if that username/password is in the file. If so let them login. I differentiated a login with username/password from a message being sent by the first couple letters of the string being something like 'login1234' or something. The obvious downside is if a user sends a message that begins with 'login1234'

How do you guys take care of this?


Visit my blog! http://jameshambrick.com
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The way some chat clients handle something like this is to have commands, prefixed by a "/" or ":" or whatever.
James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282

thanks
James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282

Okay I am still working on this login thing for the chatsoftware. I have the client sending the login reguest, the server authenticating it, but I cannot seem to figure out how to get the server to send an "accpeted" response. Here my fill code.

Client


Server


















David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Is that thing you're printing to System.out supposed to go to the client instead?
James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282

David Newton wrote:Is that thing you're printing to System.out supposed to go to the client instead?




No, "loginaccepted" is supposed to be sent to the client.
James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282

got that part working. Now I'm going to have it search through a file to the username/password. Then send to everyone(all the clients) the new user that connected so it can be added to the JList.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Best way for login authentication
 
Similar Threads
Admin tool: "Invalid direct reference to form login"
Advice on a putting dynamic message on jsp page depending on action taken by user
Setting Security in Jakarta Tomcat 4.1.18
conditionally targetting the client frame based on Server(servlet) program
Cross Site Request Forgery (CSRF)