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

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

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

origin: geoserver/geoserver

@Override
public UserDetails loadUserByUsername(String username)
    throws UsernameNotFoundException, DataAccessException {
  GeoServerUser user = null;
  try {
    user = getUserByUsername(username);
    if (user == null) throw new UsernameNotFoundException(userNotFoundMessage(username));
    RoleCalculator calculator =
        new RoleCalculator(this, getSecurityManager().getActiveRoleService());
    user.setAuthorities(calculator.calculateRoles(user));
  } catch (IOException e) {
    throw new UsernameNotFoundException(userNotFoundMessage(username), e);
  }
  return user;
}
origin: geoserver/geoserver

  /**
   * Implements roles retrieval from the J2EE container.
   *
   * @param request
   * @param principal
   * @throws IOException
   */
  protected Collection<GeoServerRole> getRolesFromJ2EE(
      HttpServletRequest request, String principal) throws IOException {

    Collection<GeoServerRole> roles = new ArrayList<GeoServerRole>();
    boolean useActiveService =
        getRoleServiceName() == null || getRoleServiceName().trim().length() == 0;

    GeoServerRoleService service =
        useActiveService
            ? getSecurityManager().getActiveRoleService()
            : getSecurityManager().loadRoleService(getRoleServiceName());

    for (GeoServerRole role : service.getRoles())
      if (request.isUserInRole(role.getAuthority())) roles.add(role);

    RoleCalculator calc = new RoleCalculator(service);
    calc.addInheritedRoles(roles);
    calc.addMappedSystemRoles(roles);
    return roles;
  }
}
origin: geoserver/geoserver

/**
 * Calculates roles from a {@link GeoServerRoleService} The default service is {@link
 * GeoServerSecurityManager#getActiveRoleService()}
 *
 * <p>The result contains all inherited roles, but no personalized roles
 *
 * @param request
 * @param principal
 * @throws IOException
 */
protected Collection<GeoServerRole> getRolesFromRoleService(
    HttpServletRequest request, String principal) throws IOException {
  boolean useActiveService =
      getRoleServiceName() == null || getRoleServiceName().trim().length() == 0;
  GeoServerRoleService service =
      useActiveService
          ? getSecurityManager().getActiveRoleService()
          : getSecurityManager().loadRoleService(getRoleServiceName());
  RoleCalculator calc = new RoleCalculator(service);
  return calc.calculateRoles(principal);
}
origin: org.geoserver.web/web-security

  @Override
  protected List<GeoServerRole> load() {
    List<GeoServerRole> tmp = new ArrayList<GeoServerRole>();
    List<GeoServerRole> result = new ArrayList<GeoServerRole>();
    try {
      GeoServerUserGroupService ugService = getSecurityManager()
          .loadUserGroupService(ugServiceName);
      GeoServerRoleService gaService = getSecurityManager()
          .getActiveRoleService();
      RoleCalculator calc = new RoleCalculator(ugService, gaService);
      tmp.addAll(rolePalette.getSelectedRoles());
      calc.addInheritedRoles(tmp);
      for (GeoServerUserGroup group : userGroupPalette.getSelectedGroups()) {
        if (group.isEnabled()) {
          tmp.addAll(calc.calculateRoles(group));
        }
      }
      result.addAll(calc.personalizeRoles(user, tmp));
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  
    Collections.sort(result);
    return result;
  }
}
origin: org.geoserver.web/web-sec-core

  @Override
  protected List<GeoServerRole> load() {
    List<GeoServerRole> tmp = new ArrayList<GeoServerRole>();
    List<GeoServerRole> result = new ArrayList<GeoServerRole>();
    try {
      GeoServerUserGroupService ugService = getSecurityManager()
          .loadUserGroupService(ugServiceName);
      GeoServerRoleService gaService = getSecurityManager()
          .getActiveRoleService();
      RoleCalculator calc = new RoleCalculator(ugService, gaService);
      tmp.addAll(rolePalette.getSelectedRoles());
      calc.addInheritedRoles(tmp);
      for (GeoServerUserGroup group : userGroupPalette.getSelectedGroups()) {
        if (group.isEnabled()) {
          tmp.addAll(calc.calculateRoles(group));
        }
      }
      result.addAll(calc.personalizeRoles(user, tmp));
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  
    Collections.sort(result);
    return result;
  }
}
origin: org.geoserver.web/gs-web-sec-core

  @Override
  protected List<GeoServerRole> load() {
    List<GeoServerRole> tmp = new ArrayList<GeoServerRole>();
    List<GeoServerRole> result = new ArrayList<GeoServerRole>();
    try {
      GeoServerUserGroupService ugService =
          getSecurityManager().loadUserGroupService(ugServiceName);
      GeoServerRoleService gaService = getSecurityManager().getActiveRoleService();
      RoleCalculator calc = new RoleCalculator(ugService, gaService);
      tmp.addAll(rolePalette.getSelectedRoles());
      calc.addInheritedRoles(tmp);
      for (GeoServerUserGroup group : userGroupPalette.getSelectedGroups()) {
        if (group.isEnabled()) {
          tmp.addAll(calc.calculateRoles(group));
        }
      }
      result.addAll(calc.personalizeRoles(user, tmp));
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    Collections.sort(result);
    return result;
  }
}
origin: org.geoserver.security/sec-jdbc

@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException,
    DataAccessException {
  GeoServerUser user=null;
  try {
    user = getUserByUsername(username);            
    if (user==null)
      throw new UsernameNotFoundException(userNotFoundMessage(username));
    RoleCalculator calculator = new RoleCalculator(this, 
        getSecurityManager().getActiveRoleService());
    user.setAuthorities(calculator.calculateRoles(user));
  } catch (IOException e) {
    throw new UsernameNotFoundException(userNotFoundMessage(username),e);
  }        
  return user;
}

origin: org.geoserver.community/gs-sec-oauth2

    new RoleCalculator(getSecurityManager().getActiveRoleService());
if (calc != null) {
  try {
origin: org.geoserver.security/gs-sec-ldap

RoleCalculator calc = new RoleCalculator(getSecurityManager().getActiveRoleService());
try {
  roles.addAll(calc.calculateRoles(new GeoServerUser(auth.getName())));
origin: org.geoserver.security/gs-sec-ldap

@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
  GeoServerUser user = null;
  try {
    user = getUserByUsername(username);
    if (user == null) {
      throw new UsernameNotFoundException(userNotFoundMessage(username));
    }
    RoleCalculator calculator =
        new RoleCalculator(this, getSecurityManager().getActiveRoleService());
    user.setAuthorities(calculator.calculateRoles(user));
  } catch (IOException e) {
    throw new UsernameNotFoundException(userNotFoundMessage(username), e);
  }
  return user;
}
origin: org.geoserver.community/gs-geofence-server

if (getDefaultSecurityService() instanceof GeoServerRoleService) {
  calc =
      new RoleCalculator(
          userGroupService,
          (GeoServerRoleService) getDefaultSecurityService());
    new RoleCalculator(
        userGroupService, securityManager.getActiveRoleService());
if (calc != null) {
origin: org.geoserver.security/sec-jdbc

  roles.addAll(details.getAuthorities());                        
} else {        
  RoleCalculator calc = new RoleCalculator(getSecurityManager().getActiveRoleService());
  try {
    roles.addAll(calc.calculateRoles(new GeoServerUser(user)));
origin: org.geoserver.security/gs-security-tests

ugService.initializeFromConfig(ugconfig);
RoleCalculator calc = new RoleCalculator(ugService, service);
SortedSet<GeoServerRole> roles;
org.geoserver.security.implRoleCalculator<init>

Javadoc

Constructor

Popular methods of RoleCalculator

  • calculateRoles
  • addInheritedRoles
  • personalizeRoles
  • addMappedSystemRoles
  • addParentRole
    Collects the ascendents for a GeoServerRole object
  • assertRoleServiceNotNull
    Check if the role service is not null
  • getRoleService
  • getUserGroupService

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setContentView (Activity)
  • setScale (BigDecimal)
  • findViewById (Activity)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • JFrame (javax.swing)
  • Top Vim plugins
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