Package org.apache.shiro.authz

Examples of org.apache.shiro.authz.Permission


        failureEndpoint.assertIsSatisfied();
    }
   
    protected RouteBuilder createRouteBuilder() throws Exception {
        List<Permission> permissionsList = new ArrayList<Permission>();
        Permission permission = new WildcardPermission("zone1:readwrite:*");
        permissionsList.add(permission);
       
        final ShiroSecurityPolicy securityPolicy = new ShiroSecurityPolicy("./src/test/resources/securityconfig.ini", passPhrase, true, permissionsList);
       
        return new RouteBuilder() {
View Full Code Here


        failureEndpoint.assertIsSatisfied();
    }
   
    protected RouteBuilder createRouteBuilder() throws Exception {
        List<Permission> permissionsList = new ArrayList<Permission>();
        Permission permission = new WildcardPermission("zone1:readwrite:*");
        permissionsList.add(permission);
       
        final ShiroSecurityPolicy securityPolicy = new ShiroSecurityPolicy("./src/test/resources/securityconfig.ini", passPhrase, true, permissionsList);
       
        return new RouteBuilder() {
View Full Code Here

        failureEndpoint.assertIsSatisfied();
    }
   
    protected RouteBuilder createRouteBuilder() throws Exception {
        List<Permission> permissionsList = new ArrayList<Permission>();
        Permission permission = new WildcardPermission("zone1:readwrite:*");
        permissionsList.add(permission);
       
        final ShiroSecurityPolicy securityPolicy = new ShiroSecurityPolicy("./src/test/resources/securityconfig.ini", passPhrase, true, permissionsList);
       
        return new RouteBuilder() {
View Full Code Here

   
        return new RouteBuilder[] {new RouteBuilder() {
            public void configure() {
               
                List<Permission> permissionsList = new ArrayList<Permission>();
                Permission permission = new WildcardPermission("zone1:readwrite:*");
                permissionsList.add(permission);
               
                final ShiroSecurityPolicy securityPolicy =
                    new ShiroSecurityPolicy("src/test/resources/securityconfig.ini", passPhrase, true, permissionsList);
               
                onException(CamelAuthorizationException.class).
                    to("mock:authorizationException");
               
                from("direct:secureEndpoint").
                    policy(securityPolicy).
                    to("log:incoming payload").
                    to("mock:success");
            }
        }, new RouteBuilder() {
            public void configure() {
               
                List<Permission> permissionsList = new ArrayList<Permission>();
                Permission permission = new WildcardPermission("zone1:readonly:*");
                permissionsList.add(permission);
                permission = new WildcardPermission("zone1:writeonly:*");
                permissionsList.add(permission);
               
                final ShiroSecurityPolicy securityPolicy =
                    new ShiroSecurityPolicy("src/test/resources/securityconfig.ini", passPhrase, true, permissionsList);
               
                onException(CamelAuthorizationException.class).
                    to("mock:authorizationException");
               
                from("direct:secureAnyEndpoint").
                    policy(securityPolicy).
                    to("log:incoming payload").
                    to("mock:success");
            }
        }, new RouteBuilder() {
            public void configure() {
               
                List<Permission> permissionsList = new ArrayList<Permission>();
                Permission permission = new WildcardPermission("zone1:readonly:*");
                permissionsList.add(permission);
                permission = new WildcardPermission("zone1:writeonly:*");
                permissionsList.add(permission);
               
                final ShiroSecurityPolicy securityPolicy =
View Full Code Here

        failureEndpoint.assertIsSatisfied();
    }
   
    protected RouteBuilder createRouteBuilder() throws Exception {
        List<Permission> permissionsList = new ArrayList<Permission>();
        Permission permission = new WildcardPermission("zone1:readwrite:*");
        permissionsList.add(permission);
       
        final ShiroSecurityPolicy securityPolicy = new ShiroSecurityPolicy("./src/test/resources/securityconfig.ini", passPhrase, true, permissionsList);
       
        return new RouteBuilder() {
View Full Code Here

  @Override
  protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection arg0) {

    SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(Collections.singleton("role"));

    Permission permission = new WildcardPermission("other:perm");

    info.setObjectPermissions(Collections.singleton(permission));

    return info;
  }
View Full Code Here

  }

  // ==

  protected Permission getOrCreate(final String permission) {
    Permission result = instances.get(permission);
    if (result == null) {
      Permission newPermission = delegateCreate(permission);
      result = instances.putIfAbsent(permission, newPermission);
      if (result == null) {
        // put succeeded, use new value
        result = newPermission;
      }
View Full Code Here

  @Override
  protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection arg0) {

    SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(Collections.singleton("role"));

    Permission permission = new WildcardPermission("test:perm");

    info.setObjectPermissions(Collections.singleton(permission));

    return info;
  }
View Full Code Here

      throws Exception
  {
    ExceptionCatchingModularRealmAuthorizer subject =
        new ExceptionCatchingModularRealmAuthorizer(Collections.<Realm>singleton(BROKEN_REALM));

    Permission permission = new AllPermission();

    Assert.assertFalse(subject.isPermitted((PrincipalCollection) null, ""));
    Assert.assertFalse(subject.isPermitted((PrincipalCollection) null, permission));
    Assert.assertFalse(subject.isPermitted((PrincipalCollection) null, new String[]{""})[0]);
    Assert.assertFalse(subject.isPermitted((PrincipalCollection) null, Collections.singletonList(permission))[0]);
View Full Code Here

    assertFalse(REQUEST_SERVER1_URI2.implies(ROLE_SERVER_SERVER1_URI_URI2));
    assertFalse(REQUEST_SERVER1_URI1.implies(ROLE_SERVER_SERVER1_URI_URI2));
  };
  @Test
  public void testUnexpected() throws Exception {
    Permission p = new Permission() {
      @Override
      public boolean implies(Permission p) {
        return false;
      }
    };
View Full Code Here

TOP

Related Classes of org.apache.shiro.authz.Permission

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.