Package com.alu.e3.auth

Examples of com.alu.e3.auth.MockAuthDataAccess


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

    // Setting the username = "win" should succeed
    exchange.getIn().setHeader(AuthHttpHeaders.Authorization.toString(), "Vlasic "+new String(Base64.encodeBase64("win:blarg".getBytes())));
    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.setId("123");

    // Setting the username = "win" should succeed
    // This one is bad because it is missing the space between Basic and the user/pass
    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);   

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

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

    // This one should be denied because the MockData is rigged to return null
    exchange.getIn().setHeader(AuthHttpHeaders.Authorization.toString(), "Basic "+new String(Base64.encodeBase64("win:blarg".getBytes())));
    HttpBasicExecutor executor = new HttpBasicExecutor(new MockAuthDataAccess(null, null, null));
   
    AuthReport authReport = executor.checkAllowed(exchange, api);
   
    assertNull("This authentication should have failed", authReport.getAuthIdentity());
  }
View Full Code Here

          LOG.debug("Getting Policy:", policyId);
        }

        com.alu.e3.data.model.Policy policyDataModel = dataManager.getPolicyById(policyId);
        if(policyDataModel == null)
          throw new InvalidIDException("A Policy with that ID does not exist");

        Policy policy = BeanConverterUtil.fromDataModel(policyDataModel);

        PolicyResponse response = new PolicyResponse(PolicyResponse.SUCCESS);
        response.setPolicy(policy);
View Full Code Here

*/
public class PropertyExtractionProcessor implements Processor {

  @Override
  public void process(Exchange exchange) throws Exception {
    AuthIdentity identity = (AuthIdentity) exchange.getProperty(ExchangeConstantKeys.E3_AUTH_IDENTITY.toString());
    Map<String, String> props = resolveProperties(identity);

    exchange.setProperty(ExchangeConstantKeys.E3_MODEL_PROPERTIES.toString(), props);
  }
View Full Code Here

  @Override
  public void process(Exchange exchange) throws Exception {

    // Get current AuthIdentity
    AuthIdentity authIdentity = exchange.getProperty( ExchangeConstantKeys.E3_AUTH_IDENTITY.toString(), AuthIdentity.class);

    // extracts subscriber id and checks authorization
    String subscriberId = extractSubscriberId(exchange);
    if (null == subscriberId) return ;
View Full Code Here

public class SubscriberIDGenerator implements Processor {
 
  @Override
  public void process(Exchange exchange) throws Exception {

    AuthIdentity authIdentity = exchange.getProperty(ExchangeConstantKeys.E3_AUTH_IDENTITY.toString(), AuthIdentity.class);
   
    String subscriberId = null;
   
    //TODO: Check if It's what we need as subscriberID
    if (authIdentity == null || authIdentity.getAuth() == null || authIdentity.getApi() == null)
      subscriberId = UUID.randomUUID().toString();
    else
      // Align subscriberId format with SubscriberIdExtractor processor!
      subscriberId = new StringBuilder(authIdentity.getApi().getId()).append("|").append(authIdentity.getAuth().getId()).toString();
   
    exchange.getIn().setHeader(E3Constant.SUBSCRIBER_ID_HEADER_NAME, subscriberId);
  }
View Full Code Here

  private int queueWaitingSize = 2000; // Only default

  private static PerfWatch perfWatch;
  public PerfWatch getPerfWatch() {
    if (perfWatch == null )
      perfWatch = new PerfWatch();
   
    return perfWatch;
  }
View Full Code Here

  private static final int TDR_FILE_AGE = 30 * 1000;   // TDR file age rotation trigger

  private static PerfWatch perfWatch;
  public PerfWatch getPerfWatch() {
    if (perfWatch == null )
      perfWatch = new PerfWatch();
   
    return perfWatch;
  }
View Full Code Here

  private static Logger logger = Logger.getLogger(TDRResponseProcessor.class);

  private static PerfWatch perfWatch;
  public PerfWatch getPerfWatch() {
    if (perfWatch == null )
      perfWatch = new PerfWatch();
   
    return perfWatch;
  }
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.