Package org.atomojo.app.auth

Examples of org.atomojo.app.auth.UserGuard


                  }
               } else {
                  storage = storageFactory.getStorage(dbinfo.getDB());
               }
               currentDBList.put(dbName,Boolean.TRUE);
               UserGuard adminGuard = new UserGuard(childContext,ChallengeScheme.HTTP_BASIC,"Atom Administrator",auth);
               adminGuard.getRequiredGroups().add(AuthService.ADMIN_GROUP);

               adminGuard.setNext(new AdminApplication(childContext,dbinfo.getDB(),storage,AtomApplication.RESOURCE_BASE));
               admins.put(dbName,adminGuard);
               for (Router router : adminRouters) {
                  router.attach("/admin/database/"+dbName,adminGuard).getTemplate().setMatchingMode(Template.MODE_STARTS_WITH);
               }
            }
View Full Code Here


         }
      };
      uploadFilter.setNext(new UploadApplication(getContext(),atomApp));
      router.attach("/upload",uploadFilter);
      router.attach("/app",atomApp);
      Filter guard = new UserGuard(getContext(),ChallengeScheme.HTTP_BASIC,"Atom User",atomApp.getAuthService());
      guard.setNext(router);
      return guard;
   }
View Full Code Here

         AuthService service = services.get(authName);
         if (service==null) {
            getLogger().severe("Cannot find auth service "+authName+" for admin interface.");
            continue;
         }
         UserGuard adminGuard = new UserGuard(childContext,ChallengeScheme.HTTP_BASIC,"Atom Administrator",service);
         adminGuard.getRequiredGroups().add(AuthService.ADMIN_GROUP);
         adminGuard.setNext(admin);
        
         vhost.attach("/admin",adminGuard);
        
      }
     
      admins = new HashMap<String,Restlet>();
      Restlet lastAdmin = null;
      for (final DB adminDB : dbList.values()) {
         getLogger().info("Configuring database "+adminDB.getName()+" for administration");
         ServerConfiguration.Database databaseConf = serverConf.getDatabases().get(adminDB.getName());
         AuthService service = null;
         if (databaseConf==null || databaseConf.getAuthName()==null) {
            service = new DBAuthService();
            Properties props = new Properties();
            props.setProperty("database",adminDB.getName());
            props.setProperty("dir", adminDB.getDatabaseDir().getAbsolutePath());
            try {
               service.init(props);
            } catch (AuthException ex) {
               getLogger().log(Level.SEVERE,"Cannot instantiate auth service for database "+adminDB.getName(),ex);
               continue;
            }
         } else {
            service = services.get(databaseConf.getAuthName());
            if (service==null) {
               getLogger().severe("Cannot find auth service "+databaseConf.getAuthName()+" for database "+adminDB.getName());
               continue;
            }
         }
         DBInfo dbinfo = new DBInfo(adminDB.getName(),adminDB,service,databaseConf==null ? null : databaseConf.getGroup(),databaseConf==null ? null : databaseConf.getGroupAlias());
         dbConfList.put(dbinfo.getName(),dbinfo);
         UserGuard adminGuard = new UserGuard(childContext,ChallengeScheme.HTTP_BASIC,"Atom Administrator",service);
         adminGuard.getRequiredGroups().add(AuthService.ADMIN_GROUP);

         try {
            adminGuard.setNext(new AdminApplication(childContext,adminDB,storageFactory.getStorage(adminDB),AtomApplication.RESOURCE_BASE));
            admins.put(adminDB.getName(),adminGuard);
            for (Router router : adminRouters) {
               router.attach("/admin/database/"+adminDB.getName(),adminGuard).getTemplate().setMatchingMode(Template.MODE_STARTS_WITH);
            }
            lastAdmin = adminGuard;
View Full Code Here

  
   @Override
   public Restlet createRoot() {  
      Router router = new Router(getContext());
      router.setDefaultMatchingMode(Template.MODE_STARTS_WITH);
      Filter guard = new UserGuard(getContext(),ChallengeScheme.HTTP_BASIC,"Atom User",auth);
      guard.setNext(router);
     
      Redirector byId = new IdRedirector(getContext(),this,atomDB,RESOURCE_BASE);
      router.attach("/id/",byId);
     
      ProtocolByPathFinder byPath = new ProtocolByPathFinder(getContext(),this,RESOURCE_BASE,app,atomDB,storage);
View Full Code Here

TOP

Related Classes of org.atomojo.app.auth.UserGuard

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.