• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Best way for login authentication

 
James Hambrick
Ranch Hand
Posts: 282
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The way some chat clients handle something like this is to have commands, prefixed by a "/" or ":" or whatever.
 
James Hambrick
Ranch Hand
Posts: 282
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
James Hambrick
Ranch Hand
Posts: 282
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that thing you're printing to System.out supposed to go to the client instead?
 
James Hambrick
Ranch Hand
Posts: 282
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 282
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic