Package org.atomojo.auth.service.db

Examples of org.atomojo.auth.service.db.Realm


            getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
            return new StringRepresentation("The alias '"+alias+"' does not contain all letters or digits.");
         }
        
         try {
            Realm realm = null;
            try {
               realm = fetch();
            } catch (IllegalArgumentException ex) {
               getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
               return new StringRepresentation("Invalid UUID value for realm id.");
View Full Code Here


         UUID id = UUID.fromString(suuid);
         realm = db.getRealm(id);
      }
      return realm;
       */
      Realm realm = (Realm)getRequest().getAttributes().get(AuthApplication.REALM_ATTR);
      return realm;
   }
View Full Code Here

   }
  
   protected RealmUser fetch()
      throws SQLException
   {
      Realm realm = (Realm)getRequest().getAttributes().get(AuthApplication.REALM_ATTR);
      /*
      Realm realm = null;
      if (name!=null) {
         realm = db.getRealm(name);
      }
View Full Code Here

            Role editorRole = db.getRole(AuthDB.EDITOR_ROLE);
            if (editorRole==null) {
               getResponse().setStatus(Status.SERVER_ERROR_INTERNAL);
               return new StringRepresentation("Editor role not found.");
            }
            Realm realm = db.getRealm(name);
            if (realm!=null) {
               getResponse().setStatus(Status.CLIENT_ERROR_CONFLICT);
               return new StringRepresentation("Realm "+name+" already exists.");
            }
            realm = db.getRealm(id);
            if (realm!=null) {
               getResponse().setStatus(Status.CLIENT_ERROR_CONFLICT);
               return new StringRepresentation("Realm with id "+id+" already exists.");
            }
           
            realm = db.createRealm(name,id);
            try {
               Group group = db.createGroup(realm,UUID.randomUUID(),"admin");
               group.addRole(rootRole);
               group.addRole(editorRole);
               Representation responseEntity = new DBObjectRepresentation(MediaType.APPLICATION_XML,realm);
               responseEntity.setCharacterSet(CharacterSet.UTF_8);
               getResponse().setStatus(Status.SUCCESS_CREATED);
               return responseEntity;
            } catch (SQLException ex) {
               getContext().getLogger().log(Level.SEVERE,"Cannot create realm admin group.",ex);
               try {
                  realm.delete();
               } catch (SQLException ex2) {
                  getContext().getLogger().log(Level.SEVERE,"Cannot delete realm ("+name+","+id+") for cleanup",ex2);
               }
               getResponse().setStatus(Status.SERVER_ERROR_INTERNAL);
               return new StringRepresentation("Cannot create realm admin group.");
View Full Code Here

TOP

Related Classes of org.atomojo.auth.service.db.Realm

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.