public void setUid(String uid) { ((InetOrgPerson) instance).uid = uid; if (instance.getUsername() == null) { setUsername(uid); } }
public void setUid(String uid) { ((InetOrgPerson) instance).uid = uid; if (instance.getUsername() == null) { setUsername(uid); } }
public void setUid(String uid) { ((InetOrgPerson) instance).uid = uid; if(instance.getUsername() == null) { setUsername(uid); } }
private boolean holdBrowserTerminalUser(HttpServletRequest request) throws ShepherException { String userName = null; if (ShepherConstants.LOGIN_TYPE_LDAP.equals(loginType.toUpperCase())) { SecurityContextImpl context = (SecurityContextImpl) request.getSession().getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY); if (context != null) { userName = ((LdapUserDetailsImpl) context.getAuthentication().getPrincipal()).getUsername(); } } else if (ShepherConstants.LOGIN_TYPE_CAS.equals(loginType.toUpperCase())) { Assertion assertion = (Assertion) request.getSession().getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION); userName = assertion.getPrincipal().getName(); } else if (ShepherConstants.LOGIN_TYPE_DEMO.equals(loginType.toUpperCase())) { SecurityContextImpl context = (SecurityContextImpl) request.getSession().getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY); if (context != null) { userName = ((UserDetails) context.getAuthentication().getPrincipal()).getUsername(); } } else { throw ShepherException.createIllegalLoginTypeException(); } if (userName != null) { User user = userService.createIfNotExist(userName); userHolder.setUser(user); String requestURI = request.getRequestURI(); String httpMethod = request.getMethod(); logger.info("userId:{}, userName:{}, {}:{}", user.getId(), user.getName(), httpMethod, requestURI); } return true; }