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 8389489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:44:29+00:00 2026-06-09T18:44:29+00:00

I have a JSF web application that uses cookies for automatic authentication without prompting

  • 0

I have a JSF web application that uses cookies for automatic authentication without prompting for username & password. It uses a cookie with username and a random UUID, and uses a WebFilter for redirection.

When there are no cookies on the client side, the authentication is done through HttpServletRequest #login(String username, String password). Behind the scenes, this approach uses JAAS authentication, and uses a LDAP server behind.

My problem comes when my application recognizes the user through the cookies holding the userid and the UUID. In this situation,

  1. the application doesn’t know the password, so the method HttpServletRequest #login(String username, String password) cannot be used.
  2. Should I ask the password to the LDAP server through JNDI? This doesn’t seem to be possible at a first glance
  3. Alternatively, I could store the password in my db. But this would mean duplication of information, and I don’t like it.
  4. I have seen around people simply setting the attribute “role” to the session, but this doesn’t seem to be equivalent to a JAAS login. With “equivalent” I mean being able to use isUserInRole() and getUserPrincipal() methods.

So, the question is: how am I supposed to log in the user in this case? I hope that the question is clearer now.

EDIT

In order to let the code speak, I add a simplified version of the Managed Bean:

@ManagedBean
@SessionScoped 
public class loginBean() {
    private String username = null;
    private String password = null;
    private UUID uuid = null;
    private boolean rememberMe = false;

    public void doLogin() {
        checkCookies();   // this method sets the property values after checking if 
                          // username & uuid match the ones saved previously
        if (username != null && uuid != null && rememberMe) {
            // authenticate automatically. Here I don't know how to proceed, because 
            // I don't have the password, unless I have saved it in the application's db,
            // duplicating it because it's already in LDAP server.
        } else {
            httpServletRequest.login(username, password);  // this uses LDAP behind JAAS
            createCookies();  // this method also saves username & uuid in the app's db
        }
    }
  • 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-06-09T18:44:30+00:00Added an answer on June 9, 2026 at 6:44 pm

    To do an actual container login in a custom way (in your case via an cookie and UUID instead of the password), you need to create your own login module.

    The dedicated API in Java EE for this is JASPI/JASPIC (people can never quite agree on the name, complicating eg google queries).

    A login module is in full control and does not have to authenticate with the ldap server (if your app can locally verify with 100% certainty that the cookie is valid). You probably do have to authorize the user (ask the ldap server for the roles/groups the user has).

    As an alternative to JASPI/JASPIC you can also look at the proprietary login module mechanism that your server is using.

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

Sidebar

Related Questions

We have a JSF web application that uses Acegi security. We also have a
We have JSF web application that generates XLS file and gives user link to
I am developing a web application that uses JSF 1.2 for the view layer.
I have web application wich uses jsf 2.0 and spring 3.0 The problem is
I have a web application written in JSF2 that uses Spring. I need to
I have J2EE web application which uses JSF framework. Now I am trying to
I have a Tomcat 6 JSF web application that I'd like to set up
I have connecting to my database in a JSF web application that I am
i have a JSF web application. I use Beans as Spring Beans (not JSF
I have a Java-JSF Web Application on GlassFish, in which I want to use

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.