Examples of Citizen


Examples of anvil.server.Citizen

 

  public synchronized Citizen createCitizen(String name, String credentials)
  {
    load();
    Citizen citizen = createCitizen(getNextId(), name, credentials);
    save(false);
    return citizen;
  }
View Full Code Here

Examples of anvil.server.Citizen

 

  public synchronized Citizen createCitizen(String name, String credentials, String[][] params)
  {
    load();
    Citizen citizen = createCitizen(getNextId(), name, credentials);
    if (params != null) {
      for (int i=0,l=params.length; i<l; i++) {
        citizen.setVariable(params[i][0], Any.create(params[i][1]));
      }
    }
    save(false);
    return citizen;
 
View Full Code Here

Examples of anvil.server.Citizen

  }


  public Citizen getCitizen(String username)
  {
    Citizen citizen = (Citizen)_citizens.get(username);
    if (citizen == null) {
      Citizen mc = createCitizen(username, "xxx");
      _root.attach(mc);
      citizen = mc;
    }
    return citizen;
  }
View Full Code Here

Examples of anvil.server.Citizen

  }


  public Citizen getCitizen(String username)
  {
    Citizen citizen = (Citizen)_citizens.get(username);
    if (citizen == null) {
      Citizen mc = createCitizen(username, "xxx");
      _root.attach(mc);
      citizen = mc;
    }
    return citizen;
  }
View Full Code Here

Examples of anvil.server.Citizen

  }


  public Citizen getCitizen(String username)
  {
    Citizen citizen = (Citizen)_citizens.get(username);
    if (citizen == null) {
      Citizen mc = createCitizen(username, "xxx");
      _root.attach(mc);
      citizen = mc;
    }
    return citizen;
  }
View Full Code Here

Examples of anvil.server.Citizen

     
      return false;
    }
   
    String citizenName = session.getCitizen();
    Citizen citizen = null;

    if (citizenName != null) {
      citizen = realm.getCitizen(citizenName);
    }
   
    if (citizen != null && citizen.getRealm().equals(realm)) {
      return true;
   
    } else {
      HttpServletRequest request = context.getRequest();

      String clientIp = request.getRemoteAddr();
      context.log().info("client ip: "+clientIp);
      Citizen[] searchResult = realm.searchCitizenByVariable("ctz.ip", clientIp);
      if (searchResult != null && searchResult.length > 0) {
        context.setCitizen(searchResult[0]);
        context.log().info("web: ipauthentication ok");
       
        if (context.getOriginalPathinfo().equals(loginPath)) {
          throw new RedirectException(context.getSession().getId(), forwardPath);
        }
        return true;
      }

      String username = request.getParameter("webauth.username");
      String password = request.getParameter("webauth.password");
     
      context.getSession().removeAttribute("webauth.failedUser");
     
      if (username != null && password != null && username.length() > 0) {
        citizen = realm.getCitizen(username);
        context.log().info("username: '"+username+"' citizen: "+citizen);
        if (citizen != null && citizen.verifyCredentials(password)) {
          context.setCitizen(citizen);
          context.log().info("web: authentication ok");
         
          if (context.getOriginalPathinfo().equals(loginPath)) {
            throw new RedirectException(context.getSession().getId(), forwardPath);
View Full Code Here

Examples of anvil.server.Citizen

 
  public AnyContext(anvil.server.Context context)
  {
    Session session = context.getSession();
    Citizen citizen = context.getCitizen();
    _context      = context;
    _any_request  = new AnyRequest(context.getRequest());
    _any_response = new AnyResponse(context.getResponse());
    _any_session  = (session != null) ? new AnySession(session) : Any.UNDEFINED;
    _any_citizen  = (citizen != null) ? new AnyCitizen(citizen) : Any.UNDEFINED;
View Full Code Here

Examples of anvil.server.Citizen

      } else if (attribute.equals("session")) {
        return _any_session;
      } else if (attribute.equals("citizen")) {
        context.checkAccess(AnyCitizen.CAN_READ);
        if (_any_citizen == Any.UNDEFINED) {
          Citizen tmpc = _context.getCitizen();
          if (tmpc != null) {
            _any_citizen = new AnyCitizen(tmpc);
          }
        }
        return _any_citizen;
View Full Code Here

Examples of anvil.server.Citizen

    if (access != null) {
      String realmName = access.getRealm();
      context.checkRealm(realmName);
      Realm realm = zone.getRealm(realmName);
      if (realm != null) {
        Citizen citizen = realm.getCitizen(name);
        if (citizen != null) {
          if (credentials != null) {     
            if (citizen.verifyCredentials(credentials)) {
              return new AnyCitizen(citizen);
            }
          } else {
            return new AnyCitizen(citizen);
          }
View Full Code Here

Examples of anvil.server.Citizen

    Log log = log();
    if (log.getSeverity() >= Log.DEBUG) {
      log.debug(perm.toString());
    }
 
    Citizen citizen = _citizen;
    if (citizen != null) {
      PermissionCollection pc = citizen.getCombinedPermissions();
      if (pc != null) {
        if (pc.implies(perm)) {
          return true;
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.