Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] HttpServletRequest Returns NULL Principal After Logging In

I have really simple implementation after following the way you told me:

public class MyUserLoginModule extends AbstractLoginModule {

  @Override
  public UserInfo getUserInfo(String userName) throws Exception {
    // As I have my own checkCredential impl, credential is useless for my
case
    return new MyUserInfo(userName, null);
  }
}

public class MyUserInfo extends UserInfo {

  public MyUserInfo(String userName, Credential credential) {
      super(userName, credential);
  }

  @Override
  public boolean checkCredential(Object suppliedCredential) {
    boolean success = false;
    String userName = this.getUserName();
    String passwd = "";

    // I found it's actually a string
    if (suppliedCredential.getClass() == String.class)
      passwd = new String((String) suppliedCredential);
    }

    success = MyValidator.validate(userName, passwd);

    return success;
  }
}

Actually my information might be misleading as I'm not pretty sure what
might be the cause. Overall speaking, the current phenomena is:
 - No session created when HttpServletRequest is caught in doPost
(getSession(false) returns null)
 - For login request, getUserPrincipal does return the user. But it then
returns null for the second time

Not sure how helpful this information is. Again, many thanks for all your
patience and help!



--
Sent from: http://jetty.4.x6.nabble.com/Jetty-User-f3247280.html


Back to the top