Package com.alu.e3.data.model

Examples of com.alu.e3.data.model.CallDescriptor


  public void process(Exchange exchange) throws Exception {
    Api api = this.dataManager.getApiById(apiId, false);
    HttpServletRequest request = (HttpServletRequest) exchange.getIn().getHeader(Exchange.HTTP_SERVLET_REQUEST);
    //retrieve the real IP adress from the request
    String remoteAddr = CommonTools.remoteAddr(request);
    CanonicalizedIpAddress ip = new CanonicalizedIpAddress(remoteAddr);
    if(this.dataManager.isIpAllowed(api, ip.getIp())) {
      exchange.setProperty(ExchangeConstantKeys.E3_API.toString(), api);   
    }
    else {
      Exception exception = new GatewayException(GatewayExceptionCode.AUTHORIZATION, "Not Authorized from this IP address");
      exchange.setException(exception);     
View Full Code Here


    this.apiId = apiId;
  }
 
  @Override
  public void process(Exchange exchange) throws Exception {
    Api api = this.dataManager.getApiById(apiId, false);
    HttpServletRequest request = (HttpServletRequest) exchange.getIn().getHeader(Exchange.HTTP_SERVLET_REQUEST);
    //retrieve the real IP adress from the request
    String remoteAddr = CommonTools.remoteAddr(request);
    CanonicalizedIpAddress ip = new CanonicalizedIpAddress(remoteAddr);
    if(this.dataManager.isIpAllowed(api, ip.getIp())) {
View Full Code Here

    Map<String, String> properties = (Map<String,String>) exchange.getProperty(ExchangeConstantKeys.E3_MODEL_PROPERTIES.toString());
    if(properties == null)
      properties = new HashMap<String, String>();

    // First add the TDRs from the API
    Api api = identity.getApi();
    if (api != null)
      if(doStatic)
        processTdrGenerationRuleStatic(api.getTdrGenerationRule(), exchange, properties);
      else
        processTdrGenerationRuleDynamic(api.getTdrGenerationRule(), exchange, properties, efType);

    // Next add all of the tdr values for the Policies
    Iterator<CallDescriptor> it = identity.getCallDescriptors().iterator();
    while(it.hasNext()){
      CallDescriptor cd = it.next();
View Full Code Here


  protected List<CallDescriptor> checkSubscriberIdAuth(String subscriberId, AuthIdentity authIdentity) throws GatewayException {

    // Get subscriber matching CallDescriptors
    Auth auth;
    try {
      auth = dataManager.getAuthById(subscriberId);
    } catch (InvalidIDException e) {
      throw new GatewayException(GatewayExceptionCode.AUTHORIZATION, e.getMessage() );
    }

    if (auth == null || !auth.getStatus().isActive()) {
      throw new GatewayException(GatewayExceptionCode.AUTHORIZATION, "Authorization status is invalid");
    }

    return   dataManager.getMatchingPolicies(authIdentity.getApi(), auth);
View Full Code Here

          processTdrGenerationRuleDynamic(policy.getTdrGenerationRule(), exchange, properties, efType);
      }
    }

    // Finally add the values from the Auth
    Auth auth = identity.getAuth();
    if(auth != null)
      if(doStatic)
        processTdrGenerationRuleStatic(auth.getTdrGenerationRule(), exchange, properties);
      else
        processTdrGenerationRuleDynamic(auth.getTdrGenerationRule(), exchange, properties, efType);
  }
View Full Code Here

    Map<String, String> props = new HashMap<String,String>();

    props.putAll(identity.getApi().getProperties());
    Iterator<CallDescriptor> it = identity.getCallDescriptors().iterator();
    while(it.hasNext()){
      CallDescriptor cd = it.next();
      Policy policy = cd.getPolicy();
      if(policy != null){
        props.putAll(policy.getProperties());
      }
    }
View Full Code Here

        processTdrGenerationRuleDynamic(api.getTdrGenerationRule(), exchange, properties, efType);

    // Next add all of the tdr values for the Policies
    Iterator<CallDescriptor> it = identity.getCallDescriptors().iterator();
    while(it.hasNext()){
      CallDescriptor cd = it.next();
      Policy policy = cd.getPolicy();
      if(policy != null){
        if(doStatic)
          processTdrGenerationRuleStatic(policy.getTdrGenerationRule(), exchange, properties);
        else
          processTdrGenerationRuleDynamic(policy.getTdrGenerationRule(), exchange, properties, efType);
View Full Code Here

    AuthIdentity id = new AuthIdentity();
    Api api = new Api();
    Policy policy1 = new Policy();
    Auth auth = new Auth();
    CallDescriptor cd = new CallDescriptor(policy1, 0, 0);

    id.setApi(api);
    id.setAuth(auth);
    id.getCallDescriptors().add(cd);
View Full Code Here

    Policy p1 = new Policy();
    p1.setId("abcd");

   
    // same cd
    CallDescriptor cd_p1 = new CallDescriptor(p1, -1, -1);
    assertThat(cd_p1, is(cd_p1));
   
    // different cd with same non-null policy
    CallDescriptor cd2_p1 = new CallDescriptor(p1, -1, -1);
    assertThat(cd2_p1, is(cd_p1));
   
    // same non-null policy, different bucket id
    CallDescriptor cd_p1_bucket = new CallDescriptor(p1, 0, -1);
    assertThat(cd_p1_bucket, is(not(cd_p1)));
   
    // same non-null policy, different context id
    CallDescriptor cd_p1_context = new CallDescriptor(p1, -1, 0);
    assertThat(cd_p1_context, is(not(cd_p1)));
   
    // same non-null policy, different bucket & bucket id
    CallDescriptor cd_p1_ctx_buck = new CallDescriptor(p1, 0, 0);
    assertThat(cd_p1, is(not(cd_p1_ctx_buck)));
   
    // comparing with non null policy but null policy id
    Policy p_idn = new Policy();
    CallDescriptor cd_pn_idn = new CallDescriptor(p_idn, -1, -1);
    assertThat(cd_p1, is(not(cd_pn_idn)));
   
    // comparing with non null policy but null policy id
    CallDescriptor cd_pn_idn_bucket = new CallDescriptor(p_idn, 0, -1);
    assertThat(cd_p1, is(not(cd_pn_idn_bucket)));
   
    // comparing with non null policy but null policy id
    CallDescriptor cd_pn_idn_context = new CallDescriptor(p_idn, -1, 0);
    assertThat(cd_p1, is(not(cd_pn_idn_context)));

    // comparing with null policy
    CallDescriptor cd_pn = new CallDescriptor(null, -1, -1);
    assertThat(cd_p1, is(not(cd_pn)));
    assertThat(cd_pn, is(not(cd_p1)));
   
    // comparing 2 null policies
    CallDescriptor cd2_pn = new CallDescriptor(null, -1, -1);
    assertThat(cd_pn, is(cd2_pn));

   
    // comparing with different policy but same policy id
    Policy p2 = new Policy();
    p2.setId("abcd");
   
    // different policy with same id
    CallDescriptor cd2_p2 = new CallDescriptor(p2, -1, -1);
    assertThat(cd2_p2, is(cd_p1));
   
    // different policy with same id + different bucket id
    CallDescriptor cd2_p2_bucket = new CallDescriptor(p1, 0, -1);
    assertThat(cd2_p2_bucket, is(not(cd2_p2)));
   
    // different policy with same id + different context id
    CallDescriptor cd2_p2_context = new CallDescriptor(p1, -1, 0);
    assertThat(cd2_p2_context, is(not(cd2_p2)));
   
    // different policy with same id + different context & bucket id
    CallDescriptor cd2_p2_ctx_buck = new CallDescriptor(p1, 0, 0);
    assertThat(cd2_p2_ctx_buck, is(not(cd2_p2)));

  }
View Full Code Here

    applyHeaderTransforms(api.getHeaderTransformations(), type, properties, exchange);

    // Next add all of the tdr values for the Policies
    Iterator<CallDescriptor> it = identity.getCallDescriptors().iterator();
    while(it.hasNext()){
      CallDescriptor cd = it.next();
      Policy policy = cd.getPolicy();
      if(policy != null){
        HeaderTransHelper.applyHeaderTransforms(policy.getHeaderTransformations(), type, properties, exchange);
      }
    }
View Full Code Here

TOP

Related Classes of com.alu.e3.data.model.CallDescriptor

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.