Package com.alu.e3.auth

Examples of com.alu.e3.auth.MockAuthDataAccess


    a.setType            (fromDataModel(auth.getAuthDetail().getType()));
    a.setTdr            (fromDataModel(auth.getTdrGenerationRule()));
    a.setHeaderTransformations  (BeanConverterUtil.<com.alu.e3.prov.restapi.model.HeaderTransformation,HeaderTransformation>fromDataModels(auth.getHeaderTransformations()));

    for(String keyname : auth.getProperties().keySet()){
      Key k = new Key();
      k.setName(keyname);
      k.setValue(auth.getProperties().get(keyname));
      a.getProperties().add(k);
    }

    switch(auth.getAuthDetail().getType()) {
    case AUTHKEY:
View Full Code Here


    p.setTdrOnLimitReached    (policy.getTdrOnLimitReached());
    p.setHeaderTransformations  (BeanConverterUtil.<com.alu.e3.prov.restapi.model.HeaderTransformation,HeaderTransformation>fromDataModels(policy.getHeaderTransformations()));


    for(String keyname : policy.getProperties().keySet()){
      Key k = new Key();
      k.setName(keyname);
      k.setValue(policy.getProperties().get(keyname));
      p.getProperties().add(k);
    }

    return p;
  }
View Full Code Here

  private static final Data fromDataModelToData(Map<String, String> keys) {
    if (keys==null) throw new IllegalArgumentException("keys must not be null");
    Data d = new Data();
    for(Map.Entry<String, String> entry : keys.entrySet()) {
      Key k = new Key();
      k.setName  (entry.getKey());
      k.setValue  (entry.getValue());
      d.getKey().add(k);
    }
    return d;
  }
View Full Code Here

    return b;
  }

  private static OAuth fromDataModelToOAuth(AuthDetail authDetail) {
    if (authDetail==null) throw new IllegalArgumentException("authDetail must not be null");
    OAuth b = new OAuth();
    b.setClientId(authDetail.getClientId());
    b.setClientSecret(authDetail.getClientSecret());
    return b;
  }
View Full Code Here

  protected final Action newCreateAction() {
    return new Action() {

      @Override
      protected Object doAction(Object... params) {
        Policy policy = (Policy) params[0];

        if ((policy.getId() == null) || (policy.getId().equals("")))
        {
          // create the id
          policy.setId(UUID.randomUUID().toString());
        }

        /**
         * Some validation
         */
        for(Key key : policy.getProperties()){
          if(key.getName() == null || key.getName().isEmpty())
            throw new IllegalArgumentException("All properties must have a name");
        }

        if(LOG.isDebugEnabled()) {
          LOG.debug("Creating Policy:", policy.getId());
        }

        com.alu.e3.data.model.Policy policyDataModel = BeanConverterUtil.toDataModel(policy);
        dataManager.addPolicy(policyDataModel);

        PolicyResponse response = new PolicyResponse(PolicyResponse.SUCCESS);
        response.setId(policy.getId());

        return response;
      }
    };
  }
View Full Code Here

  protected final Action newUpdateAction() {
    return new Action() {

      @Override
      protected Object doAction(Object... params) {
        Policy policy = (Policy) params[0];
        String policyId = (String) params[1];

        /**
         * Some validation
         */
        for(Key key : policy.getProperties()){
          if(key.getName() == null || key.getName().isEmpty())
            throw new IllegalArgumentException("All properties must have a name");
        }

        if(LOG.isDebugEnabled()) {
          LOG.debug("Updating Policy:", policyId);
        }

        if(policy.getId() == null || policy.getId().equals(""))
          policy.setId(policyId);
        else if(policy.getId().equals(policyId) == false)
          throw new InvalidParameterException("Policy ID mismatch");

        com.alu.e3.data.model.Policy policyDataModel = BeanConverterUtil.toDataModel(policy);       
        dataManager.updatePolicy(policyDataModel);

View Full Code Here

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

        return response;
View Full Code Here

        }

        com.alu.e3.data.model.Policy policyDataModel = BeanConverterUtil.toDataModel(policy);
        dataManager.addPolicy(policyDataModel);

        PolicyResponse response = new PolicyResponse(PolicyResponse.SUCCESS);
        response.setId(policy.getId());

        return response;
      }
    };
  }
View Full Code Here

          throw new InvalidParameterException("Policy ID mismatch");

        com.alu.e3.data.model.Policy policyDataModel = BeanConverterUtil.toDataModel(policy);       
        dataManager.updatePolicy(policyDataModel);

        return new PolicyResponse(PolicyResponse.SUCCESS);
      }
    };
  }
View Full Code Here

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

        dataManager.removePolicy(policyId);

        return new PolicyResponse(PolicyResponse.SUCCESS);
      }
    };
  }
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.