protected User getUser(String username) { User user = null; try{ user = userManager.getUser(username); } catch (SecurityException secex){ } return user; }
if(!requestContext.getUserPrincipal().getName().equals(userManager.getAnonymousUser())) User user = userManager.getUser(principal.getName()); if(user != null) Subject userSubject = userManager.getSubject(user); if ( userSubject != null )
protected void deleteData(Map<String,Object> settings, Logger log) throws SerializerException { if (isSettingSet(settings, JetspeedSerializer.KEY_PROCESS_PROFILER)) { log.info("deleting profiling rules and user profiling rules"); try { String anonymousUser = userManager.getAnonymousUser(); for (User _user : userManager.getUsers("")) { for (PrincipalRule rule : pm.getRulesForPrincipal(_user)) { pm.deletePrincipalRule(rule); } } Iterator<ProfilingRule> _itRules = pm.getRules().iterator(); while ( _itRules.hasNext() ) { pm.deleteProfilingRule(_itRules.next()); } } catch (Exception e) { throw new SerializerException(e); } } }
/** * * <p> * getUserPrincipal * </p> * Aaccess request user principal if defined or default * to profiler anonymous user * @param request * @return */ protected Principal getUserPrincipal(RequestContext request) throws Exception { Principal userPrincipal = request.getRequest().getUserPrincipal(); if (userPrincipal == null) { userPrincipal = userMgr.newTransientUser(userMgr.getAnonymousUser()); } return userPrincipal; }
if (userManager.getUser(userManager.getAnonymousUser()) == null) synchronizer.synchronizeUserPrincipal(userManager.getAnonymousUser());
if (userManager.userExists(jsuser.getName())) user = userManager.getUser(jsuser.getName()); user = userManager.addUser(jsuser.getName(), jsuser.isMapped()); PasswordCredential pwc = userManager.getPasswordCredential(user); pwc.setPassword(password, (passwordEncoding == JetspeedSerializer.PASSTHRU_REQUIRED)); log.debug("storing password for " + jsuser.getName()); userManager.storePasswordCredential(pwc); PasswordCredential pwc = userManager.getPasswordCredential(user); pwc.setEnabled(jsuser.getPwDataValueAsBoolean("enabled")); pwc.setUpdateRequired(jsuser.getPwDataValueAsBoolean("requiresUpdate")); if (d != null) pwc.setExpirationDate(d); userManager.storePasswordCredential(pwc); Subject subject = userManager.getSubject(user); List<Credential> listTemp = jsuser.getPrivateCredentials(); if ((listTemp != null) && (listTemp.size() > 0)) userManager.updateUser(user);
try { User user = userManager.addUser(userName); PasswordCredential pwc = userManager.getPasswordCredential(user); pwc.setPassword(null, password); userManager.storePasswordCredential(pwc); final String innerUserName = userName; final User innerUser = user; User powerUser = userManager.getUser(this.adminUser); JetspeedException pe = (JetspeedException) JSSubject.doAsPrivileged(userManager.getSubject(powerUser), new PrivilegedAction() { public Object run() { try { if (userManager.getUser(userName) != null) { userManager.removeUser(userName);
user = userManager.getUser(userName); subject = userManager.getSubject(user);
User user = userMgr.getUser(userPrincipal.getName()); if ( user != null ) subject = userMgr.getSubject(user); if (userPrincipal.getName().equals(userMgr.getAnonymousUser())) subject = JetspeedSubjectFactory.createSubject(userMgr.newTransientUser(userPrincipal.getName()), null, null, null);
User user = userManager.getUser(userName); user.getSecurityAttributes().getAttribute("user.name.given", true).setStringValue(userNameGiven); user.getSecurityAttributes().getAttribute("user.name.family", true).setStringValue(userNameFamily); userManager.updateUser(user); PasswordCredential credential = userManager.getPasswordCredential(user); userManager.storePasswordCredential(credential);
try portalUser = portalUserManager.getUser(email); loginLocale, loginServerName); portalUser = portalUserManager.getUser(email); portalUserManager.updateUser(portalUser); subject = portalUserManager.getSubject(portalUser);
try if (!userMgr.getAnonymousUser().equals(userPrincipal.getName()) && userMgr.userExists(userPrincipal.getName())) User user = userMgr.getUser(userPrincipal.getName()); SecurityAttribute attrib = user.getSecurityAttributes().getAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE); if (attrib != null)
User innerUser = userManager.getUser(innerUserName); innerUser.getSecurityAttributes().getAttribute(User.JETSPEED_USER_SUBSITE_ATTRIBUTE, true).setStringValue(innerSubsite); userManager.updateUser(innerUser);
User user = userManager.addUser(userName); user.getSecurityAttributes().getAttribute("user.business-info.online.email", true).setStringValue(userEmail); userManager.updateUser(user); PasswordCredential credential = userManager.getPasswordCredential(user); userManager.storePasswordCredential(credential);
User user = userManager.getUser(userName); PasswordCredential credential = userManager.getPasswordCredential(user); List<Role> roles = roleManager.getRolesForUser(user.getName()); List<String> availableRoles = roleManager.getRoleNames(null);
/** * Returns PSML base folder path for specified user by * running full profiler and portal site rules within a * JSSubject.doAsPrivileged() block with a subject matching * the specified user. * * @param user existing portal user * @param locale optional locale, (defaults to system locale, for language * profiling rules) * @param serverName server name, (required for subsite profiling rules) * @return PSML base folder path * @throws Exception */ private String invokeGetBaseFolderPath(final User user, final Locale locale, final String serverName) throws Exception { Object doneAs = JSSubject.doAsPrivileged(userManager.getSubject(user), new PrivilegedAction() { public Object run() { try { PortalSiteRequestContext requestContext = getMockPortalSiteRequestContext(user, locale, serverName); return requestContext.getBaseFolderPath(); } catch (Exception e) { return e; } } }, null); if (doneAs instanceof Exception) { throw (Exception) doneAs; } return (String) doneAs; }
for (User user : userManager.getUsers("")) Principal userPrincipal = SubjectHelper.getPrincipal(userManager.getSubject(user), User.class); if(userPrincipal != null)
Credential credential = userManager.getPasswordCredential((User) principal); Subject subject = userManager.getSubject((User) principal);
protected Subject resolveSubjectFromContext(RequestContext request, Principal userPrincipal) { if (userPrincipal.getName().equals(userMgr.getAnonymousUser())) { return null; } if (userPrincipal instanceof UserSubjectPrincipal) { return ((UserSubjectPrincipal)userPrincipal).getSubject(); } return resolveSubjectFromContainerPrincipal(request, userPrincipal); }
if (innerUserFolderPath != null) { innerUser.getSecurityAttributes().getAttribute(User.JETSPEED_USER_SUBSITE_ATTRIBUTE, true).setStringValue(innerUserFolderPath); userManager.updateUser(innerUser);