public TgwJDBCUser(Object userObject, String siteName) { super(); this.siteName = siteName; setUserObject(userObject); extractUserData(); }
public Action createParameteredAction(String parameter) { return new Action(this.actionName, parameter); }
public boolean login() throws LoginException { setUsernameAndPassword(true); authenticate(); return true; }catch(LoginException le){ cleanup(false); throw le; setUsernameAndPassword(true); try{ authenticate(); return true; }catch(LoginException le){ cleanup(false); setUsernameAndPassword(false); authenticate(); return true; }catch(LoginException le){ cleanup(false); throw le;
public boolean equals(Object o) { if (!(o instanceof TgwJDBCUser)) return false; TgwJDBCUser obj = (TgwJDBCUser) o; return obj.getName().equals(this.getName()) && obj.getSiteName().equals(this.getSiteName()); }
public boolean isUserInRole(String role) { String[] roles = user.getRoles(); for (int i = 0; i < roles.length; i++) { String aRole = roles[i]; if (aRole.equals(role)) { return true; } } return false; }
public void putActionRoles(Action action, String roles) { actionRolesMap.put(action.getActionName(), roles); }
private boolean isSiteAvailableUser(TgwUser user, HttpServletRequest httpRequest) { String accessSiteName = ControllerUtils.extractSiteName(httpRequest); if (user == null || accessSiteName == null) { return false; } if (user instanceof TgwJDBCUser) { TgwJDBCUser jdbcUser = (TgwJDBCUser) user; String availableSiteName = jdbcUser.getSiteName(); if (accessSiteName.equals(availableSiteName)) { return true; } } return false; }
private boolean bindContext() throws NamingException{ if(username == null || "".equals(username)){ return false; } Hashtable<String, String> bindenv = getCurrentBindEnvironment(); try{ new InitialContext(bindenv); return true; }catch(AuthenticationException ae){ return false; } }
public boolean hasPermission(String siteName, HttpServletRequest request, Action action) { if (action.getParameter() == null) { return siteService.hasPermission(siteName, request, action); } else { return false; } }
public int hashCode(){ return getName().hashCode(); }
public int hashCode() { return getName().hashCode(); }
public String[] getRoles(String username) { String userdn = directory.buildUserDN(username); TgwUser user = directory.getUser(userdn); return user.getRoles(); } }
public String[] getRoleNames(Action action) { String roles = actionRolesMap.get(action.getActionName()); if (roles == null) { return new String[0]; } return roles.split(","); }
public static Action getAction(String actionName) { int index = ArrayUtils.indexOf(ACTION_NAMES, actionName); if (index >= 0) { return ACTIONS[index]; } return new Action(actionName); } }
public int hashCode(){ return getName().hashCode(); }
public String getRemoteUser() { if (user != null) { return user.getName(); } return super.getRemoteUser(); }