• Post Reply Bookmark Topic Watch Topic
  • New Topic

Websphere Programmatic Login  RSS feed

Dermot Bolger
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anybody know if websphere programattic login using the actually works!
I've secured a jsp and a bean.
I use a nonsecured servlet to access the secured bean
supplying the necessary userid and password to the ServerSideAuthenticator
to gain access to the secured bean.
This works fine, however if I try access a secured servlet in the same manner
ie. check authentication against the ServerSideAuthenticator and forward to the
secured servlet I keep getting the popup login screen on the browser.
Is the ServerSideAuthenticator supposed to be used for accessing secured web pages?
Please see code attached
public void doGet(
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException, java.io.IOException {
try {
boolean forceAuthentication = true;
String userid = request.getParameter("userid");
String password = request.getParamete("password");
// Create a new security context to hold
// authentication data.
ServerSideAuthenticator serverAuth = new ServerSideAuthenticator();
// Perform authentication based on supplied data org.omg.SecurityLevel2.Credentials credentials = serverAuth.login(userid, password, forceAuthentication);
// Retrieve the user's name from the credentials
// so we can tell the user that login succeeded.
String username = serverAuth.getUserName(credentials);
System.out.println( "Authentication successful for user: " + username
// Access secure bean
P1BeanHome p1beanHome = null;
P1Bean p1bean = null;
InitialContext initCtx = new InitialContext();
Object objref = initCtx.lookup("ejb/ie/iss/test/P1BeanHome");
p1beanHome = (P1BeanHome) PortableRemoteObject.narrow(objref, P1BeanHome.class);
System.out.println("in nonsecureservlet3 doget method got home");
p1bean = p1beanHome.create();
// works fine up to here
getServletContext().getRequestDispatcher(response.encodeURL("Secure1.jsp")).forward(request, response);
//fails to do forward
} catch (Exception e) {
System.out.println("in nonsecureservlet3 doget method error is " + e);
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!