Package de.iritgo.aktera.authorization

Examples of de.iritgo.aktera.authorization.AuthorizationException


      operationCode = "*";
    }

    if (ue.getGroups().size() == 0)
    {
      throw new AuthorizationException("User '" + ue.getLoginName() + "' is not a member of any groups");
    }

    try
    {
      pf = getPersistentFactory();

      Persistent serviceSecurity = pf.create("component-security.componentsecurity");

      serviceSecurity.setBypassAuthorizationManager(bypassAm);

      /* Iterate through all the groups that this principal is a member of */
      String oneGroup = null;

      for (Iterator j = ue.getGroups().iterator(); j.hasNext();)
      {
        oneGroup = (String) j.next();

        serviceSecurity.clear();
        serviceSecurity.setField("component", getComponentName(o.getService()));
        serviceSecurity.setField("groupname", oneGroup);

        if (log.isDebugEnabled())
        {
          log.debug("Looking for " + serviceSecurity.toString());
        }

        if (serviceSecurity.find())
        {
          log.debug("Found componentsecurity record, checking operation " + operationCode);

          if (operationCode.equals("*"))
          {
            return true;
          }

          if (serviceSecurity.getFieldString("operationsallowed").indexOf(operationCode) > 0)
          {
            return true;
          }

          if (serviceSecurity.getFieldString("operationsallowed").equals("*"))
          {
            return true;
          }
        }
      }
    }
    catch (PersistenceException pe)
    {
      log.error("Database error checking authorization", pe);
      throw new AuthorizationException(pe);
    }
    catch (AuthorizationException ae)
    {
      log.error("Authorization error while checking authorization", ae);
      throw new AuthorizationException(ae);
    }
    finally
    {
      releaseService(pf);

View Full Code Here


        }
      }
    }
    catch (PersistenceException pe)
    {
      throw new AuthorizationException(pe);
    }
    finally
    {
      releaseService(pf);
View Full Code Here

      return false;
    }
    else
    {
      throw new AuthorizationException("Unknown comparator '" + comparator + "'");
    }
  }
View Full Code Here

    {
      log.error("Authorization exception while checking authorization", ae);
    }
    catch (ContextException e)
    {
      throw new AuthorizationException("Context exception - no login", e);
    }
    catch (NullPointerException ne)
    {
      throw new AuthorizationException("Null pointer exception retrieving from context", ne);
    }

    return returnValue;
  }
View Full Code Here

      myFactory = (PersistentFactory) getService(PersistentFactory.ROLE, tmpFactory.getSecurity(), c);
    }
    catch (ServiceException se)
    {
      throw new AuthorizationException("An error occured while trying to fetch the PersistentFactory.", se);
    }

    return myFactory;
  }
View Full Code Here

    PersistentFactory pf = null;

    if (ue.getGroups().size() == 0)
    {
      throw new AuthorizationException("User '" + ue.getLoginName() + "' is not a member of any groups");
    }

    try
    {
      pf = getPersistentFactory();

      Persistent serviceSecurity = pf.create("component-security.instancesecurity");

      serviceSecurity.setBypassAuthorizationManager(bypassAm);

      /* Iterate through all the groups that this principal is a member of */
      String oneGroup = null;

      for (Iterator j = ue.getGroups().iterator(); j.hasNext();)
      {
        oneGroup = (String) j.next();

        serviceSecurity.clear();
        serviceSecurity.setField("component", getComponentName(o.getService()));
        serviceSecurity.setField("groupname", oneGroup);
        serviceSecurity.setField("instance", instanceName);

        if (log.isDebugEnabled())
        {
          log.debug("Looking for " + serviceSecurity.toString());
        }

        if (serviceSecurity.find())
        {
          if (operationCode.equals("*"))
          {
            return true;
          }

          if (serviceSecurity.getFieldString("allowedoperations").indexOf(operationCode) > 0)
          {
            return true;
          }

          if (serviceSecurity.getFieldString("allowedoperations").equals("*"))
          {
            return true;
          }
        }
      }
    }
    catch (PersistenceException pe)
    {
      log.error("Database error checking authorization", pe);
      throw new AuthorizationException(pe);
    }
    catch (AuthorizationException ae)
    {
      log.error("Authorization error while checking authorization", ae);
      throw new AuthorizationException(ae);
    }
    finally
    {
      releaseService(pf);

View Full Code Here

    {
      uid = Integer.valueOf(p.getName()).intValue();
    }
    catch (NumberFormatException e)
    {
      throw new AuthorizationException("Uid=" + p.getName() + " cannot be converted to an int");
    }

    return uid;
  }
View Full Code Here

   */
  private Iterator getPrincipals(Class clazz) throws AuthorizationException
  {
    if (subject == null)
    {
      throw new AuthorizationException("Cannot get principals, subject is null");
    }

    Set p = subject.getPrincipals(clazz);

    if (p.isEmpty())
    {
      throw new AuthorizationException("No principals of type " + clazz.getName());
    }

    return p.iterator();
  }
View Full Code Here

TOP

Related Classes of de.iritgo.aktera.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.