Skip to Content
author's profile photo
Former Member

Obtanin an IPortalComponentRequest In a LoginModule

Hello ,

I'm trying to develop a class to be used in an authentication scheme so it needs to implement LoginModule interfaz and I want to get an IPortalComponentRequest in this class but I don't know how ( if it's possible ).

Do you know any method to do this ?

Thanks a lot and best regards


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • author's profile photo
    Former Member
    Posted on Jun 21, 2004 at 05:35 PM

    Not sure about the IPortalComponentRequest,but you can geet a HttpServletRequest

    public boolean login() throws LoginException {
    		if (callbackHandler == null) {
    			throw new LoginException("Error: no CallbackHandler available to garner authentication information from the user");
    		//TODO declare a Callback array (1 element) and 
    		//     assign a WebCallback object to the array
    		Callback[] callbacks = new Callback[1];
    		callbacks[0] = new WebCallback();
    		try {
    			//TODO get the user ID in the cookie from the request object (contained in the callbacks[0])
    			Cookie[] cookies = 
    				((WebCallback) callbacks[0]).getRequest().getCookies();
    			for (int i=0; i<cookies.length; i++) {
    				Cookie c = cookies<i>;
    					System.out.println("cookie: " + c.getName() + " = "+c.getValue());
    				if (c.getName().equals(cookieName)) {
    					//TODO get the cookie value and decrypt it
    					userID = decrypt(c.getValue());

    (what you are looking for is ((WebCallback) callbacks[0]).getRequest()

    (code taken for JAAS login example,

    Add comment
    10|10000 characters needed characters exceeded