Tabnine Logo
GeoServerRole.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.geoserver.security.impl.GeoServerRole
constructor

Best Java code snippets using org.geoserver.security.impl.GeoServerRole.<init> (Showing top 20 results out of 315)

origin: geoserver/geoserver

public GeoServerRole createRoleObject(String role) throws IOException {
  return new GeoServerRole(role);
}
origin: geoserver/geoserver

public GeoServerRole createRoleObject(String role) throws IOException {
  return new GeoServerRole(role);
}
origin: geoserver/geoserver

@Override
public GeoServerRole convertRoleFromString(String roleString, String userName) {
  if (roleString == null) return null;
  roleString = roleString.trim();
  if (roleString.isEmpty()) return null;
  checkDelimiters();
  List<String> working = splitString(roleString.trim(), getRoleParameterStartString());
  GeoServerRole result = new GeoServerRole(working.get(0));
  if (working.size() == 1) {
    return result;
  }
  // we have role parameters
  result.setUserName(userName);
  if (working.get(1).endsWith(getRoleParameterEndString()) == false)
    throw createExcpetion(roleString + " does not end with " + getRoleParameterEndString());
  int index = working.get(1).lastIndexOf(getRoleParameterEndString());
  String roleParamString = working.get(1).substring(0, index).trim();
  working = splitString(roleParamString, getRoleParameterDelimiterString());
  for (String kvp : working) {
    List<String> tmp = splitString(kvp.trim(), getRoleParameterAssignmentString());
    if (tmp.size() != 2)
      throw createExcpetion(roleString + " Invalid role string:  " + roleString);
    result.getProperties().put(tmp.get(0).trim(), tmp.get(1).trim());
  }
  return result;
}
origin: geoserver/geoserver

  protected void addRolesToCreate(GeoServerRoleStore roleStore, String... roleNames)
      throws IOException {
    for (String roleName : roleNames) {
      expect(roleStore.createRoleObject(roleName))
          .andReturn(new GeoServerRole(roleName))
          .anyTimes();
    }
  }
}
origin: geoserver/geoserver

protected GeoServerRoleStore createRoleStore(
    String name, GeoServerSecurityManager secMgr, String... roleNames) throws IOException {
  GeoServerRoleStore roleStore = createNiceMock(GeoServerRoleStore.class);
  expect(roleStore.getSecurityManager()).andReturn(secMgr).anyTimes();
  expect(roleStore.getName()).andReturn(name).anyTimes();
  for (String roleName : roleNames) {
    expect(roleStore.getRoleByName(roleName))
        .andReturn(new GeoServerRole(roleName))
        .anyTimes();
  }
  for (GeoServerRole role : GeoServerRole.SystemRoles) {
    String roleName = role.getAuthority();
    expect(roleStore.createRoleObject(roleName))
        .andReturn(new GeoServerRole(roleName))
        .anyTimes();
  }
  expect(secMgr.loadRoleService(name)).andReturn(roleStore).anyTimes();
  return roleStore;
}
origin: org.geoserver.security/sec-jdbc

/**
 * @see org.geoserver.security.GeoServerRoleService#createRoleObject(java.lang.String)
 */
public GeoServerRole createRoleObject(String role) {
  return new GeoServerRole(role);
}

origin: org.geoserver.security/gs-sec-ldap

@Override
public GeoServerRole createRoleObject(String role) throws IOException {
  return new GeoServerRole(rolePrefix + (convertToUpperCase ? role.toUpperCase() : role));
}
origin: org.geoserver.web/web-security

public NewRolePage(String roleServiceName) {
  super(roleServiceName, new GeoServerRole(GeoServerRole.NULL_ROLE.getAuthority()));
  
  if (hasRoleStore(roleServiceName)==false) {
    throw new RuntimeException("Workflow error, new role not possible for read only service");
  }
}
origin: org.geoserver/gs-restconfig

protected void insert(GeoServerRoleService roleService, String roleName) throws IOException {
  GeoServerRoleStore store = getStore(roleService);
  try {
    store.addRole(new GeoServerRole(roleName));
  } finally {
    store.store();
  }
}
origin: org.geoserver.security/gs-security-tests

@Test
public void testRoles() throws Exception {
  copyWebXML("web2.xml");
  GeoServerRoleService service = getSecurityManager().loadRoleService("test2");
  assertEquals(4, service.getRoleCount());
  assertTrue(service.getRoles().contains(new GeoServerRole("role1")));
  assertTrue(service.getRoles().contains(new GeoServerRole("role2")));
  assertTrue(service.getRoles().contains(new GeoServerRole("employee")));
  assertTrue(service.getRoles().contains(new GeoServerRole("MGR")));
}
origin: org.geoserver.security/gs-security-tests

  @Override
  public GeoServerSecurityManager createSecurityManager(MockTestData testData)
      throws Exception {
    GeoServerSecurityManager secMgr =
        createNiceMock(GeoServerSecurityManager.class);
    GeoServerRoleStore roleStore =
        createRoleStore("test", secMgr, "admin", "groupAdmin", "role1");
    addRolesToCreate(roleStore, "admin", "groupAdmin");
    expect(roleStore.getAdminRole())
        .andReturn(new GeoServerRole("admin"))
        .anyTimes();
    expect(roleStore.getGroupAdminRole())
        .andReturn(new GeoServerRole("groupAdmin"))
        .anyTimes();
    replay(roleStore, secMgr);
    return secMgr;
  }
});
origin: org.geoserver.security/gs-sec-ldap

private void checkUserNamesForRole(String roleName, int expected, boolean userFilter)
    throws IOException {
  createRoleService(userFilter);
  SortedSet<String> userNames = service.getUserNamesForRole(new GeoServerRole(roleName));
  assertNotNull(userNames);
  assertEquals(expected, userNames.size());
}
origin: org.geoserver.security/gs-security-tests

expect(roleStore.removeRole(new GeoServerRole("unused"))).andReturn(true);
origin: org.geoserver.security/gs-security-tests

  @Override
  public GeoServerSecurityManager createSecurityManager(MockTestData testData)
      throws Exception {
    GeoServerSecurityManager secMgr =
        createNiceMock(GeoServerSecurityManager.class);
    GeoServerUserGroupStore ugStore1 = createUserGroupStore("test1", secMgr);
    addUsers(ugStore1, "user1", "abc");
    addGroups(ugStore1, "group1");
    GeoServerUserGroupStore ugStore2 = createUserGroupStore("test2", secMgr);
    addUsers(ugStore1, "user2", "abc");
    addGroups(ugStore1, "group2");
    GeoServerRoleStore roleStore = createRoleStore("test", secMgr, "role1");
    expect(roleStore.getGroupNamesForRole(new GeoServerRole("role1")))
        .andReturn(new TreeSet<String>(Arrays.asList("group1", "group2")))
        .anyTimes();
    replay(ugStore1, ugStore2, roleStore, secMgr);
    return secMgr;
  }
});
origin: org.geoserver.web/web-security

@Override
protected void onFormSubmit(GeoServerRole role) throws IOException {
  
  GeoServerRoleStore store = null;
  try {
    //copy into a new one so we can set the name properly
    GeoServerRole newRole = 
      new GeoServerRole(get("form:name").getDefaultModelObjectAsString());
    newRole.setUserName(role.getUserName());
    newRole.getProperties().putAll(role.getProperties());
    role = newRole;
    store = new RoleStoreValidationWrapper(getRoleStore(roleServiceName));
    store.addRole(role);
    String parentRoleName = get("form:parent").getDefaultModelObjectAsString();
    if (parentRoleName != null) {
      GeoServerRole parentRole = store.getRoleByName(parentRoleName);
      store.setParentRole(role, parentRole);
    }
    store.store();
  } catch (IOException ex) {
    try {store.load(); } catch (IOException ex2) {};
    throw ex;
  }
}
origin: org.geoserver.security/gs-security-tests

@Test
public void testConverter() {
  GeoServerRole r1 = new GeoServerRole("r1");
  r1.getProperties().setProperty("r1_p1", "r1_v1");
  r1.getProperties().setProperty("r1_p2", "r1_v2");
  GeoServerRole r2 = new GeoServerRole("r2");
  r2.getProperties().setProperty("r2_p1", "r2_v1");
  GeoServerRole r3 = new GeoServerRole("r3");
origin: org.geoserver.security/gs-security-tests

checkForAuthenticatedRole(auth);
assertEquals(testUserName, ((UserDetails) auth.getPrincipal()).getUsername());
assertTrue(auth.getAuthorities().contains(new GeoServerRole(rootRole)));
assertTrue(auth.getAuthorities().contains(new GeoServerRole(derivedRole)));
checkForAuthenticatedRole(auth);
assertEquals(testUserName, ((UserDetails) auth.getPrincipal()).getUsername());
assertTrue(auth.getAuthorities().contains(new GeoServerRole(rootRole)));
assertTrue(auth.getAuthorities().contains(new GeoServerRole(derivedRole)));
origin: org.geoserver.web/web-sec-core

role=new GeoServerRole("");
origin: org.geoserver.web/gs-web-sec-core

boolean hasRoleStore = hasRoleStore(roleServiceName);
if (role == null) role = new GeoServerRole("");
origin: org.geoserver.community/gs-authkey

assertTrue(user.getAuthorities().contains(new GeoServerRole("ROLE_MYROLE_1")));
assertTrue(user.getAuthorities().contains(new GeoServerRole("ROLE_MYROLE_2")));
org.geoserver.security.implGeoServerRole<init>

Popular methods of GeoServerRole

  • getAuthority
  • getProperties
  • getUserName
  • setUserName
  • equals
  • toString
  • compareTo
  • equalsWithoutUserName
  • isAnonymous

Popular in Java

  • Making http requests using okhttp
  • setScale (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setRequestProperty (URLConnection)
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Reference (javax.naming)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now