Package com.alu.e3.rate.model

Examples of com.alu.e3.rate.model.GatewayRate


  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

  }

  public static final Auth toDataModel(com.alu.e3.prov.restapi.model.Auth authData) {
    if (authData==null) throw new IllegalArgumentException("authData must not be null");

    Auth auth = new Auth()
    auth.setId            (authData.getId());
    auth.setStatus          (toDataModel(authData.getStatus()));
    auth.setTdrGenerationRule    (toDataModel(authData.getTdr()));
    auth.setApiContext           (authData.getApiContext());
    auth.setPolicyContext         (authData.getPolicyContext());
    auth.setHeaderTransformation    (BeanConverterUtil.<HeaderTransformation, com.alu.e3.prov.restapi.model.HeaderTransformation>toDataModels(authData.getHeaderTransformations()));

    for(Key prop : authData.getProperties()){
      auth.getProperties().put(prop.getName(), prop.getValue());
    }

    AuthDetail authDetail = new AuthDetail();
    auth.setAuthDetail        (authDetail);

    authDetail.setType        (toDataModel(authData.getType()));

    switch(authData.getType()) {
    case AUTHKEY:
      authDetail.setAuthKeyValue(authData.getAuthKeyAuth().getKeyValue());
      break;
    case BASIC:
      authDetail.setUsername(authData.getBasicAuth().getUsername());
      authDetail.setPassword(authData.getBasicAuth().getPassword());
      break;
    case IP_WHITE_LIST:
      authDetail.getWhiteListedIps().addAll(authData.getIpWhiteListAuth().getIp());
      break;
    case NO_AUTH:
      break;
    case OAUTH:
      authDetail.setClientId(authData.getOAuth().getClientId());
      authDetail.setClientSecret(authData.getOAuth().getClientSecret());
      break;
    case WSSE:
      authDetail.setUsername(authData.getWsseAuth().getUsername());
      auth.setWssePassword(authData.getWsseAuth().getPassword());
      break;
    default:
      throw new IllegalArgumentException("Unknown authType specified");
    }
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

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

    if(identity.getAuth() != null)
      props.putAll(identity.getAuth().getProperties());
View Full Code Here

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

    // Finally add the values from the Auth
    Auth auth = identity.getAuth();
View Full Code Here

TOP

Related Classes of com.alu.e3.rate.model.GatewayRate

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.