Package com.alu.e3.auth

Examples of com.alu.e3.auth.MockAuthDataAccess


    Exchange exchange = new DefaultExchange(context);
   
    Api api = new Api();
    api.setId("api3234");

    MockAuthDataAccess mockDA = new MockAuthDataAccess(null, null, null);
    NoAuthExecutor executor = new NoAuthExecutor(mockDA);
   
    AuthReport authReport = executor.checkAllowed(exchange, api);
   
    assertNotNull("This authentication should have succeeded", authReport.getAuthIdentity());
View Full Code Here


    exchange.setProperty(ExchangeConstantKeys.E3_REQUEST_PARAMETERS.toString(), parameters);

    // Setting the key in the query - should be removed
    exchange.getIn().setHeader(Exchange.HTTP_QUERY, appKeyName + "=asdf");
   
    AppKeyExecutor executor = new AppKeyExecutor(appKeyName, appHeaderName, new MockAuthDataAccess("asdf", null, null));
   
    AuthReport authReport = executor.checkAllowed(exchange, api);
   
    assertNotNull("This authentication should have succeeded", authReport.getAuthIdentity());
View Full Code Here

    api.setId("1234");

    // Setting the key in the header - should be removed
    exchange.getIn().setHeader(appHeaderName, "asdf");
   
    AppKeyExecutor executor = new AppKeyExecutor(appKeyName, appHeaderName, new MockAuthDataAccess("asdf", null, null));
   
    AuthReport authReport = executor.checkAllowed(exchange, api);
   
    assertNotNull("This authentication should have succeeded", authReport.getAuthIdentity());
View Full Code Here

    // Setting the key in the request parameters
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(appKeyName, "asdf");
    exchange.setProperty(ExchangeConstantKeys.E3_REQUEST_PARAMETERS.toString(), parameters);
   
    AppKeyExecutor executor = new AppKeyExecutor(appKeyName, appHeaderName, new MockAuthDataAccess(null, null, null));

    AuthReport authReport = executor.checkAllowed(exchange, api);
   
    assertNull("This authentication should have failed", authReport.getAuthIdentity());
  }
View Full Code Here

   
    Api api = new Api();
    api.setId("1234");

    // no parameter should fail
    AppKeyExecutor executor = new AppKeyExecutor(appKeyName, appHeaderName, new MockAuthDataAccess("asdf", null, null));
   
    AuthReport authReport = executor.checkAllowed(exchange, api);
   
    assertNull("This authentication should have failed", authReport.getAuthIdentity());
  }
View Full Code Here

    // Setting the wrong key in the request parameters
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(appKeyName.toUpperCase(), "asdf");
    exchange.setProperty(ExchangeConstantKeys.E3_REQUEST_PARAMETERS.toString(), parameters);

    AppKeyExecutor executor = new AppKeyExecutor(appKeyName, appHeaderName, new MockAuthDataAccess("asdf", null, null));
   
    AuthReport authReport = executor.checkAllowed(exchange, api);
   
    assertNull("This authentication should have failed",  authReport.getAuthIdentity());
  }
View Full Code Here

    // Setting the null key in the request parameters
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(appKeyName, null);
    exchange.setProperty(ExchangeConstantKeys.E3_REQUEST_PARAMETERS.toString(), parameters);
   
    AppKeyExecutor executor = new AppKeyExecutor(appKeyName, appHeaderName, new MockAuthDataAccess("asdf", null, null));
   
    AuthReport authReport = executor.checkAllowed(exchange, api);
   
    assertNull("This authentication should have failed", authReport.getAuthIdentity());
  }
View Full Code Here

    Api api = new Api();
    api.setId("123");

    // Setting the username = "win" should succeed
    exchange.getIn().setHeader(AuthHttpHeaders.Authorization.toString(), "Basic "+new String(Base64.encodeBase64("win:blarg".getBytes())));
    HttpBasicExecutor executor = new HttpBasicExecutor(new MockAuthDataAccess(null, "win:blarg", null));
   
    AuthReport authReport = executor.checkAllowed(exchange, api);   

    assertNotNull("This authentication should have succeeded", authReport.getAuthIdentity());
  }
View Full Code Here

    Api api = new Api();
    api.setId("123");

    // Setting the username = "win" should succeed
    exchange.getIn().setHeader(AuthHttpHeaders.Authorization.toString(), "Basic "+"win:blarg");
    HttpBasicExecutor executor = new HttpBasicExecutor(new MockAuthDataAccess(null, "win:blarg", null));
   
    AuthReport authReport = executor.checkAllowed(exchange, api);

    assertNull("This authentication should have failed", authReport.getAuthIdentity());
  }
View Full Code Here

   
    Api api = new Api();
    api.setId("123");

    // Setting the username = "win" should succeed
    HttpBasicExecutor executor = new HttpBasicExecutor(new MockAuthDataAccess(null, "win:blarg", null));
   
    AuthReport authReport = executor.checkAllowed(exchange, api);

    assertNull("This authentication should have failed", authReport.getAuthIdentity());
  }
View Full Code Here

TOP

Related Classes of com.alu.e3.auth.MockAuthDataAccess

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.