Logic to create common Serverlet3 Login

Posted by user3696143 on Programmers See other posts from Programmers or by user3696143
Published on 2014-06-08T12:57:39Z Indexed on 2014/06/08 15:42 UTC
Read the original article Hit count: 365

Filed under:
|
|

I am using Servlet3 Login to Authenticate User in website I have these Login

  1. Website Normal Login(Fill the Sigup form)
  2. Facebook Login (From Facebook Id)
  3. Twitter Login (From Twitter)

And I am already authenticate user by below code

 HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
       request.login(username, password);

And it is working fine for Website Login as user gave his/her EMailId and password and it store in DB.

Now I modified table and added more columns to save Facebookid in same user table and also password for Facebook login FacebookId work as a Password as well. Same I will do for Twitter But I want the same Servlet3 to authenticate user. How can I achieve it?

And also added context.xml file inside META-INF folder

<Realm localDataSource="true" debug="99"
    className="org.apache.catalina.realm.JDBCRealm" connectionName="user"
    connectionPassword="password" connectionURL="jdbc:mysql://localhost:3306/ ccc"
    digest="md5" driverName="com.mysql.jdbc.Driver" roleNameCol="role_name"
    userCredCol="password" userNameCol="email_id"
    userRoleTable="users_list" userTable="user_list_view" />

Also it is possible to check which query fired by realm entry?

© Programmers or respective owner

Related posts about java

Related posts about tomcat