Package ch.entwine.weblounge.common.impl.security

Examples of ch.entwine.weblounge.common.impl.security.Guest


      roles.add(getLocalRole(site, SystemRole.GUEST));
    } else {
      Object principal = auth.getPrincipal();
      if (principal == null) {
        logger.warn("No principal found in spring security context, setting current user to anonymous");
        user = new Guest(site.getIdentifier());
        roles.add(getLocalRole(site, SystemRole.GUEST));
      } else if (principal instanceof SpringSecurityUser) {
        user = ((SpringSecurityUser) principal).getUser();
        logger.debug("Principal was identified as '{}'", user.getLogin());
      } else if (principal instanceof UserDetails) {
        UserDetails userDetails = (UserDetails) principal;
        user = new UserImpl(userDetails.getUsername());
        logger.debug("Principal was identified as '{}'", user.getLogin());

        Collection<? extends GrantedAuthority> authorities = auth.getAuthorities();
        if (authorities != null && authorities.size() > 0) {
          for (GrantedAuthority ga : authorities) {
            logger.debug("Principal '{}' gained role '{}'", user.getLogin(), ga.getAuthority());
            roles.add(new RoleImpl(ga.getAuthority()));
          }
        }

      } else if (Security.ANONYMOUS_USER.equals(principal)) {
        user = new Guest(site.getIdentifier());
        roles.add(getLocalRole(site, SystemRole.GUEST));
      } else {
        logger.warn("Principal was not compatible with spring security, setting current user to anonymous");
        user = new Guest(site.getIdentifier());
        roles.add(getLocalRole(site, SystemRole.GUEST));
      }
    }

    for (Role role : roles) {
View Full Code Here


        logger.debug("No java server pages found to precompile for {}", site);
        return;
      }

      // Make sure there is a user
      security.setUser(new Guest(site.getIdentifier()));
      security.setSite(site);

      logger.info("Precompiling java server pages for '{}'", site);
      int errorCount = 0;
      Iterator<URL> rendererIterator = rendererUrls.iterator();
View Full Code Here

TOP

Related Classes of ch.entwine.weblounge.common.impl.security.Guest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.