public GeoServerUser copy() { return new GeoServerUser(this); }
/** * Convenience method for {@link #calculateRoles(GeoServerUser)} * * @param username * @throws IOException */ public SortedSet<GeoServerRole> calculateRoles(String username) throws IOException { return calculateRoles(new GeoServerUser(username)); }
public GeoServerUser createUserObject(String username, String password, boolean isEnabled) throws IOException { GeoServerUser user = new GeoServerUser(username); user.setEnabled(isEnabled); user.setPassword(password); return user; }
public static GeoServerUser createRoot() { GeoServerUser root = new GeoServerUser(GeoServerUser.ROOT_USERNAME); root.setPassword(null); root.setEnabled(true); Set<GrantedAuthority> roles = new HashSet<GrantedAuthority>(); roles.add(GeoServerRole.ADMIN_ROLE); root.setAuthorities(roles); return root; }
/** Create the geoserver default administrator */ public static GeoServerUser createDefaultAdmin() { GeoServerUser admin = new GeoServerUser(ADMIN_USERNAME); admin.setPassword(DEFAULT_ADMIN_PASSWD); admin.setEnabled(AdminEnabled); return admin; }
public static GeoServerUser createAnonymous() { GeoServerUser anon = new GeoServerUser(GeoServerUser.ANONYMOUS_USERNAME); anon.setPassword(null); anon.setEnabled(true); Set<GrantedAuthority> roles = new HashSet<GrantedAuthority>(); roles.add(GeoServerRole.ANONYMOUS_ROLE); anon.setAuthorities(roles); return anon; }
protected void addUsers(GeoServerUserGroupStore ugStore, String... up) throws IOException { for (int i = 0; i < up.length; i += 2) { GeoServerUser user = new GeoServerUser(up[i]); user.setPassword(up[i + 1]); expect(ugStore.getUserByUsername(up[i])).andReturn(user).anyTimes(); } }
public NewUserPage(String userGroupServiceName) { super(userGroupServiceName, new GeoServerUser("")); if (hasUserGroupStore(userGroupServiceName)==false) { throw new IllegalStateException("New user not possible for read only service"); } }
public NewUserPage(String userGroupServiceName) { super(userGroupServiceName, new GeoServerUser("")); if (hasUserGroupStore(userGroupServiceName) == false) { throw new IllegalStateException("New user not possible for read only service"); } }
public NewUserPage(String userGroupServiceName) { super(userGroupServiceName, new GeoServerUser("")); if (hasUserGroupStore(userGroupServiceName)==false) { throw new IllegalStateException("New user not possible for read only service"); } }
@Override public GeoServerUser getUser(String key) throws IOException { return new GeoServerUser("fakeuser"); }
/** * @see org.geoserver.security.GeoServerUserGroupService#createUserObject(java.lang.String, java.lang.String, boolean) */ public GeoServerUser createUserObject(String username,String password, boolean isEnabled) throws IOException{ GeoServerUser user = new GeoServerUser(username); user.setEnabled(isEnabled); user.setPassword(password); return user; }
@Override public GeoServerUser createUserObject(String username, String password, boolean isEnabled) throws IOException { GeoServerUser user = new GeoServerUser(username); user.setEnabled(isEnabled); user.setPassword(password); return user; }
protected GeoServerUser createUser(DirContextOperations dco) { GeoServerUser gsUser = new GeoServerUser(dco.getStringAttribute(userNameAttribute)); for (String attName : populatedAttributes) { try { Attribute att = dco.getAttributes().get(attName.toLowerCase()); if (att != null) { Object value = att.get(); if (value instanceof String) { gsUser.getProperties().put(attName, value); } } } catch (NamingException e) { LOGGER.log( Level.WARNING, "Could not populate value for user attribute " + attName, e); } } return gsUser; }
RoleCalculator calc = new RoleCalculator(getSecurityManager().getActiveRoleService()); try { roles.addAll(calc.calculateRoles(new GeoServerUser(auth.getName()))); } catch (IOException e) { throw new AuthenticationServiceException(e.getLocalizedMessage(), e);
RoleCalculator calc = new RoleCalculator(getSecurityManager().getActiveRoleService()); try { roles.addAll(calc.calculateRoles(new GeoServerUser(user))); } catch (IOException e) { throw new AuthenticationServiceException(e.getLocalizedMessage(),e);
@Test public void testBuildGeotoolsTransaction() throws IOException { Authentication authentication = null; // no authentication, defaults to "anonymous" testBuildGeotoolsTransaction(authentication, "anonymous"); // principal being a String Object principal = "John Smith"; authentication = new TestingAuthenticationToken(principal, null); testBuildGeotoolsTransaction(authentication, "John Smith"); // principal being an org.springframework.security.core.userdetails.UserDetails principal = new GeoServerUser("Akira Kurosawa"); authentication = new TestingAuthenticationToken(principal, null); testBuildGeotoolsTransaction(authentication, "Akira Kurosawa"); }