Package org.jboss.security.authorization

Examples of org.jboss.security.authorization.AuthorizationException


                  return true;
            }
            return false;
         }
         else
            throw new AuthorizationException("Unable to locate an ACL for the resource " + resource);
      }
      throw new AuthorizationException("Unable to retrieve ACL: persistece strategy not set");
   }
View Full Code Here


            }
            // no entry for identity = deny access
            return false;
         }
         else
            throw new AuthorizationException("Unable to locate an ACL for the resource " + resource);
      }
      throw new AuthorizationException("Unable to retrieve ACL: persistece strategy not set");
   }
View Full Code Here

                  if (result == PERMIT)
                     invokeCommit();
                  if (result == DENY)
                  {
                     invokeAbort();
                     throw new AuthorizationException("Denied");
                  }
                  return null;
               }
            });
         }
View Full Code Here

   private int invokeAuthorize(Resource resource) throws AuthorizationException
   {
      //Control Flag behavior
      boolean encounteredRequiredError = false;
      boolean encounteredOptionalError = false;
      AuthorizationException moduleException = null;
      int overallDecision = DENY;

      int length = super.modules.size();
      for (int i = 0; i < length; i++)
      {
         AuthorizationModule module = (AuthorizationModule) super.modules.get(i);
         ControlFlag flag = (ControlFlag) super.controlFlags.get(i);
         int decision = DENY;
         try
         {
            decision = module.authorize(resource);
         }
         catch (Exception ae)
         {
            decision = DENY;
            if (moduleException == null)
               moduleException = new AuthorizationException(ae.getMessage());
         }

         if (decision == PERMIT)
         {
            overallDecision = PERMIT;
            //SUFFICIENT case
            if (flag == ControlFlag.SUFFICIENT && encounteredRequiredError == false)
               return PERMIT;
            continue; //Continue with the other modules
         }
         //Go through the failure cases
         //REQUISITE case
         if (flag == ControlFlag.REQUISITE)
         {
            if (trace)
               log.trace("REQUISITE failed for " + module);
            if (moduleException == null)
               moduleException = new AuthorizationException("Authorization failed");
            else
               throw moduleException;
         }
         //REQUIRED Case
         if (flag == ControlFlag.REQUIRED)
         {
            if (trace)
               log.trace("REQUIRED failed for " + module);
            if (encounteredRequiredError == false)
               encounteredRequiredError = true;
         }
         if (flag == ControlFlag.OPTIONAL)
            encounteredOptionalError = true;
      }

      //All the authorization modules have been visited.
      String msg = getAdditionalErrorMessage(moduleException);
      if (encounteredRequiredError)
         throw new AuthorizationException("Authorization Failed:" + msg);
      if (overallDecision == DENY && encounteredOptionalError)
         throw new AuthorizationException("Authorization Failed:" + msg);
      if (overallDecision == DENY)
         throw new AuthorizationException("Authorization Failed:Denied.");
      return PERMIT;
   }
View Full Code Here

      for (int i = 0; i < length; i++)
      {
         AuthorizationModule module = (AuthorizationModule) super.modules.get(i);
         boolean bool = module.commit();
         if (!bool)
            throw new AuthorizationException("commit on modules failed:" + module.getClass());
      }
   }
View Full Code Here

      for (int i = 0; i < length; i++)
      {
         AuthorizationModule module = (AuthorizationModule) super.modules.get(i);
         boolean bool = module.abort();
         if (!bool)
            throw new AuthorizationException("abort on modules failed:" + module.getClass());
      }
   }
View Full Code Here

               if(result == PERMIT)
                  invokeCommit();
               if(result == DENY)
               {
                  invokeAbort();
                  throw new AuthorizationException("Denied");
               }
               return null;
            }
         });
      }
View Full Code Here

         }
         catch(Exception ae)
         {
            decision = DENY;
            if(this.moduleException == null)
               this.moduleException = new AuthorizationException(ae.getMessage());
         }
        
         if(decision == PERMIT)
         {
            this.overallDecision =  PERMIT;
            //SUFFICIENT case
            if(flag == ControlFlag.SUFFICIENT && this.encounteredRequiredError == false)
               return PERMIT;
            continue; //Continue with the other modules
         }
         //Go through the failure cases
         //REQUISITE case
         if(flag == ControlFlag.REQUISITE)
         {
            if(trace)
               log.trace("REQUISITE failed for " + module);
            if(this.moduleException == null)
               this.moduleException = new AuthorizationException("Authorization failed");
            else
               throw this.moduleException;
         }
         //REQUIRED Case
         if(flag == ControlFlag.REQUIRED)
         {
            if(trace)
               log.trace("REQUIRED failed for " + module);
            if(this.encounteredRequiredError == false)
               this.encounteredRequiredError = true;
         }
         if(flag == ControlFlag.OPTIONAL)
            this.encounteredOptionalError = true;
      }
     
      //All the authorization modules have been visited.
      if(this.encounteredRequiredError)
         throw new AuthorizationException("Authorization Failed");
      if(this.overallDecision == DENY && this.encounteredOptionalError)
         throw new AuthorizationException("Authorization Failed");
      if(this.overallDecision == DENY)
         throw new AuthorizationException("Authorization Failed:No modules active.");
      return PERMIT;
   }
View Full Code Here

      for(int i = 0; i < length; i++)
      {
         AuthorizationModule module = (AuthorizationModule)modules.get(i);
         boolean bool = module.commit();
         if(!bool)
            throw new AuthorizationException("commit on modules failed");
      }
   }
View Full Code Here

      for(int i = 0; i < length; i++)
      {
         AuthorizationModule module = (AuthorizationModule)modules.get(i);
         boolean bool = module.abort();
         if(!bool)
            throw new AuthorizationException("abort on modules failed");
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.security.authorization.AuthorizationException

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.