10-08-2005 11:30 AM
10-10-2005 04:23 AM
10-23-2005 10:39 PM
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);
}
10-24-2005 04:53 AM
03-03-2006 08:21 AM
03-05-2006 01:35 AM
03-05-2006 08:35 PM
05-16-2006 01:28 PM
05-19-2006 05:19 AM
05-30-2006 06:16 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.