Package org.apache.wicket.authorization.strategies.role

Examples of org.apache.wicket.authorization.strategies.role.Roles


    {
      throw new IllegalArgumentException("argument componentClass must be of type " +
          Component.class.getName());
    }

    final Roles roles = rolesAuthorizedToInstantiate(componentClass);
    if (roles != null)
    {
      return hasAny(roles);
    }
    return true;
View Full Code Here


    if (rolesToAdd == null)
    {
      throw new IllegalArgumentException("Argument rolesToAdd cannot be null");
    }

    Roles roles = rolesForAction.get(action);
    if (roles == null)
    {
      roles = new Roles();
      rolesForAction.put(action, roles);
    }
    roles.addAll(rolesToAdd);
  }
View Full Code Here

    if (rolesToRemove == null)
    {
      throw new IllegalArgumentException("Argument rolesToRemove cannot be null");
    }

    Roles roles = rolesForAction.get(action);
    if (roles != null)
    {
      roles.removeAll(rolesToRemove);
    }

    // If we removed the last authorized role, we authorize the empty role
    // so that removing authorization can't suddenly open something up to
    // everyone.
    if (roles.size() == 0)
    {
      roles.add(MetaDataRoleAuthorizationStrategy.NO_ROLE);
    }
  }
View Full Code Here

    if (rolesToAdd == null)
    {
      throw new IllegalArgumentException("Argument rolesToadd cannot be null");
    }

    Roles roles = rolesForComponentClass.get(componentClass);
    if (roles == null)
    {
      roles = new Roles();
      rolesForComponentClass.put(componentClass, roles);
    }
    roles.addAll(rolesToAdd);
  }
View Full Code Here

    if (rolesToRemove == null)
    {
      throw new IllegalArgumentException("Argument rolesToRemove cannot be null");
    }

    final Roles roles = rolesForComponentClass.get(componentClass);
    if (roles != null)
    {
      roles.removeAll(rolesToRemove);
    }

    // If we removed the last authorized role, we authorize the empty role
    // so that removing authorization can't suddenly open something up to
    // everyone.
    if (roles.size() == 0)
    {
      roles.add(MetaDataRoleAuthorizationStrategy.NO_ROLE);
    }
  }
View Full Code Here

    public Roles getRoles() {
        if (!isSignedIn()) {
            return null;
        }
        final List<String> roles = authenticationSession.getRoles();
        return new Roles(roles.toArray(new String[] {}));
    }
View Full Code Here

    public Roles getRoles() {
        if (!isSignedIn()) {
            return null;
        }
        final List<String> roles = authenticationSession.getRoles();
        return new Roles(roles.toArray(new String[] {}));
    }
View Full Code Here

    {
      final AuthorizeInstantiation packageAnnotation = (AuthorizeInstantiation)componentPackage
          .getAnnotation(AuthorizeInstantiation.class);
      if (packageAnnotation != null)
      {
        authorized = hasAny(new Roles(packageAnnotation.value()));
      }
    }

    // Check class annotation
    final AuthorizeInstantiation classAnnotation = (AuthorizeInstantiation)componentClass
        .getAnnotation(AuthorizeInstantiation.class);
    if (classAnnotation != null)
    {
      // If roles are defined for the class, that overrides the package
      authorized = hasAny(new Roles(classAnnotation.value()));
    }

    return authorized;
  }
View Full Code Here

  {
    if (authorizeActionAnnotation != null)
    {
      if (action.getName().equals(authorizeActionAnnotation.action()))
      {
        if (!hasAny(new Roles(authorizeActionAnnotation.roles())))
        {
          return false;
        }
      }
    }
View Full Code Here

    if (permissions == null)
    {
      permissions = new InstantiationPermissions();
      application.setMetaData(INSTANTIATION_PERMISSIONS, permissions);
    }
    permissions.authorize(componentClass, new Roles(roles));
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.authorization.strategies.role.Roles

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.