How to make auto login be available
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2005 11:30 AM
When I use hard code to set the username and password in login.jsp ,then make the form submit by itself ,this does not work.
How can I do it? plz help me
thx.
Leon
- Labels:
-
Archive

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2005 04:23 AM
All form posting in JSF is done with POST so to get the automatic login you will have to mimic a form being POSTed in the JSF environment!
Alternatively, you could write a servlet that takes your security credentials and sets up the necessary context and then redirect to the browse.jsp. An example of how security is handled this way (but only for tickets right now) you could take a look at org.alfresco.web.app.servlet.DownloadContentServlet.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2005 10:39 PM
for example, there are 2 ids
id=1, user will navigate to the space "alfresco demo"
id=2 , …"glossary"
when I use id=1 to login, the space successfully navigate to "alfresco demo", then logout, use id=2 to login ,but the space navigate to "alfresco demo" too.
following is my code, I don't know how to restore the new view
String username = "guest"; String password = "guest"; /** AuthenticationService bean reference */ AuthenticationService authenticationService = null; /** NodeService bean reference */ NodeService nodeService = null; //ApplicationContext ctx = ApplicationContextHelper.getApplicationContext(); //ApplicationContext ctx=FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance()); WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(application); ServiceRegistry serviceRegistry = (ServiceRegistry) ctx .getBean(ServiceRegistry.SERVICE_REGISTRY); // get individual, required services nodeService = (NodeService)serviceRegistry.getNodeService(); authenticationService=(AuthenticationService)ctx.getBean("authenticationService"); try { String fromsysid = (String) request.getParameter("fromsysid"); System.out.println("fromsysid=" + fromsysid); authenticationService .authenticate(username, password.toCharArray()); // setup User object and Home space ID User user = new User(username, authenticationService .getCurrentTicket(), authenticationService .getPersonNodeRef(Repository.getStoreRef(), username)); String homeSpaceId = null; if (fromsysid == null || fromsysid.trim().equals("")) { homeSpaceId = (String) nodeService.getProperty( authenticationService.getPersonNodeRef(Repository .getStoreRef(), username), ContentModel.PROP_HOMEFOLDER); NodeRef homeSpaceRef = new NodeRef(Repository.getStoreRef(), homeSpaceId); // check that the home space node exists - else user cannot login if (nodeService.exists(homeSpaceRef) == false) { throw new InvalidNodeRefException(homeSpaceRef); } } else { //get homespaceid from config-file homeSpaceId = ""; Properties pro = new Properties(); //InputStream in = new BufferedInputStream(new FileInputStream(file)); InputStream in = getClass().getResourceAsStream( "/subsysid.properties"); try { pro.load(in); homeSpaceId = pro.getProperty(fromsysid.trim()).trim(); if (homeSpaceId == null || homeSpaceId.trim().equals("")) { homeSpaceId = pro.getProperty("default").trim(); } } catch (IOException ex) { } } System.out.println(homeSpaceId); user.setHomeSpaceId(homeSpaceId); // put the User object in the Session - the authentication servlet will then allow // the app to continue without redirecting to the login page session.putValue(AuthenticationFilter.AUTHENTICATION_USER, user); response.sendRedirect(request.getContextPath() + "/faces/jsp/browse/browse.jsp"); } catch (Exception ex) { out.println("something is error."); out.println(ex); }
thanks for your help

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2005 04:53 AM
Presuming you have used the logout link in the client the session should get destroyed, so when you login again you will have an empty session meaning that JSF won't have a cached view and none of the managed beans would exist.
Therefore, it appears that the code you have should work. You may want to check that you have indeed got a new session when you login after a logout.
Let us know if this is the case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2006 08:21 AM
Thanks for your post.
Can you please send me the full servlet or jsp file used for auto login page and give me the necessary basic steps to implement that.I need that very urgently.
My email id is mpeterjohn@hotmail.com
Thanks,
John Peter.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2006 01:35 AM
jellobui at yahoo.ca
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2006 08:35 PM
I also hope my file will help us.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2006 01:28 PM
TULUM_@YAHOO.COM
thank you!!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2006 05:19 AM
i tryied to use your code, but it throws a compilation error:
getPersonNodeRef(StoreRef, String) is undefined for the type AuthenticationService
i have the alfresco's v1.2.1
may be the method is a new one of 1.3?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2006 06:16 AM
