Examples of AuthReport


Examples of com.alu.e3.common.camel.AuthReport

    // 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());

    // Check the query parameter
    assertNull("The query parameter should have been removed", exchange.getIn().getHeader(Exchange.HTTP_QUERY));
  }
View Full Code Here

Examples of com.alu.e3.common.camel.AuthReport

    // 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());

    // Check the query parameter
    assertNull("The header should have been removed", exchange.getIn().getHeader(appHeaderName));
  }
View Full Code Here

Examples of com.alu.e3.common.camel.AuthReport

    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

Examples of com.alu.e3.common.camel.AuthReport

    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

Examples of com.alu.e3.common.camel.AuthReport

   
    Policy policy = new Policy();
    mockDataManager.getCallDescriptors().add(new CallDescriptor(policy, 1, 2));
   
   
    AuthReport authReport = dataAccess.checkAllowed(api);
    AuthIdentity authIdentity = authReport.getAuthIdentity();
    assertNotNull(authIdentity);
   
    assertNotNull(authIdentity.getApi() == api); // compare memory reference
    assertNull(authIdentity.getAuth());
    assertNotNull(authIdentity.getCallDescriptors().get(0).getPolicy() == policy); // compare memory reference
View Full Code Here

Examples of com.alu.e3.common.camel.AuthReport

    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

Examples of com.alu.e3.common.camel.AuthReport

    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

Examples of com.alu.e3.common.camel.AuthReport

public class MockIpWhitelistExecutor implements IAuthExecutor {

  @Override
  public AuthReport checkAllowed(Exchange exchange, Api api) {
   
    AuthReport authReport = new AuthReport();
   
    if(exchange.getIn().getHeaders().size() > 0) {
      AuthIdentity authIdentity = new AuthIdentity();
      authIdentity.setAppId("1234");
      authReport.setAuthIdentity(authIdentity);
      authReport.setApiActive(true);
      authReport.setAuthActive(true);
     
    } else {
      authReport.setBadRequest(true);
    }
   
    //return exchange.getIn().getHeaders().size() > 0?new AppIdentity("1234"):null;
   
    return authReport; 
View Full Code Here

Examples of com.alu.e3.common.camel.AuthReport

    // 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

Examples of com.alu.e3.common.camel.AuthReport

    // 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
TOP
Copyright © 2018 www.massapi.com. 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.