aspose file tools*
The moose likes Beginning Java and the fly likes User Authentication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "User Authentication" Watch "User Authentication" New topic
Author

User Authentication

kimi lynn
Greenhorn

Joined: Jun 02, 2003
Posts: 27
Hello everbody,
what are the best possible ways for user authentication in java??Say, I've a user interface done in swing.Before the user try to do some operation, I would like to check for his credentials(password is encrypted).Never done with java before, had experience with PHP using flat files as well as databases.I dont want to use any database here.
pls point me to a nice tutorial,useful links or if somebody had a sample code, I would like to go through too.
Thanks for all your time
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

Originally posted by kimi lynn:
Hello everbody,
what are the best possible ways for user authentication in java??

The user authentication/authorization services Java makes available are in the Enterprise Edition, probably an order of magnitude more complex than you want to get into.

I dont want to use any database here.

Every time I've rolled my own auth I've used a database. It should be pretty easy to use a flat file. Store a user name, hashed password and some flags on a line as a record. Scan through the file using the user name as the record 'index'. If you want to get really fancy (or if performance is an issue, you have a couple hundred users), you could store the user records in order by user name and use java.io.RandomAcccessFile to do a binary search of the records. That would give you database-like speed without the database-like overhead. Of course you'd have to write a maintaince application to add/update/insert/delete records.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
kimi lynn
Greenhorn

Joined: Jun 02, 2003
Posts: 27
Thanks for the information.Any suggested links??
---
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

You could start with The Java Tutorial I/O Classes. As for links to building your own auth functionality, doesn't look like it on google. Hence the problem with rolling your own: nobody's done it before.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: User Authentication