Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4009032
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:49:40+00:00 2026-05-20T08:49:40+00:00

I am building web application where i am building the first stage with user

  • 0

I am building web application where i am building the first stage with user registration and login.

I am thinking of

class User 
{
    private userid;
    private firstname
    .........
    //getters and setters
}

class UserService {

    public boolean authenticate(username, password) {}
    public addUser()
    public saveuser()
    public ConfirmEmail()
    public resetPassword()
    ......

}

I have few questions

  1. Is my approach correct?
  2. Also i have diff function in front end and for backend admin user, so should i put all in one class or, i have to make diff for front end and backend?
  3. As this is the most common thing which every organisation requires, so is it possible to find it from internet so that i can see how enterprise people approach this?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T08:49:41+00:00Added an answer on May 20, 2026 at 8:49 am

    First thing, I’d look at whether you can use another authentication system like Google or Facebook, or Open ID (StackOverflow uses these and more).

    Secondly, I’d look into using a security framework like Spring Security.

    Finally, if you want/need to do it on your own from scratch, here are some pointers

    • Always store passwords using a 1-way hashing mechanism e.g. SHA
    • Use salt when hashing your password – you should have a random salt value per password (see this SO question for it’s length)
    • You can also have a constant application-wide salt value that is not stored next to the password
    • Give the users roles. This will solve your front end/back end users problem

    I’m assuming you’re using a database. Here’s an example schema (MySQL)

    CREATE TABLE users (
      id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
      mail VARCHAR(255) NOT NULL,
      name VARCHAR(255) NOT NULL,
      enc_password VARCHARCHAR(64) NOT NULL,
      salt CHAR(8) NOT NULL,
      is_mail_authenticated TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
      UNIQUE KEY (mail)
    ) ENGINE = InnoDB;
    
    CREATE TABLE roles (
      id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
      name VARCHAR(32) NOT NULL,
      UNIQUE KEY (name)
    ) ENGINE = InnoDB;
    
    CREATE TABLE users_roles (
      user_id NTEGER UNSIGNED NOT NULL,
      role_id NTEGER UNSIGNED NOT NULL,
      FOREIGN KEY (user_id) REFERENCES users (id),
      FOREIGN KEY (roel_id) REFERENCES roles (id),
    ) ENGINE = InnoDB;
    

    That’ll do it for a very basic user model. You’ll need a tool to generate your salt. I’d use randomAlphanumeric from Apache commons lang.

    You may want to add some stuff to lock user accounts after too many failed login attempts. And you may want to track the IP with which they’ve logged in from. This is left as an exercise to the reader 🙂

    I added the is_mail_authenticated field to track whether the user had authenticated their mail. This is usually accomplished by clicking a link from one’s email.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Busy building my first web application in CodeIgniter and wanted to work out the
I'm building my first web application after many years of desktop application development (I'm
I'm in the process of building my first web application using ASP.NET MVC 2
Im building a web application which is a process management app. Several different employee
I'm building a web application that guides my users through the configuration and installation
I am building a web application that uses the database for Users, Security/roles, and
I'm building a web application on .Net and it will run on 64 bit
A friend of mine is now building a web application with J2EE and Struts,
I've just been tasked with building a web application using ASP (.net) and am
I'm building a MVC web application (using the Spring MVC framework), and I'm a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.