Package com.alu.e3.data.model

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


    // Add a new Auth
    Auth auth = new Auth();
    auth.setId("id31");
    auth.setStatus(StatusType.ACTIVE);
    AuthDetail detail = new AuthDetail();
    auth.setAuthDetail(detail);
    auth.getAuthDetail().setType(NBAuthType.AUTHKEY);
    auth.getAuthDetail().setAuthKeyValue("authKey31");
    dataManager.addAuth(auth);

    // Add a new Auth
    Auth auth2 = new Auth();
    auth2.setId("id32");
    auth2.setStatus(StatusType.ACTIVE);
    auth2.setAuthDetail(new AuthDetail());
    auth2.getAuthDetail().setType(NBAuthType.BASIC);
    auth2.getAuthDetail().setUsername("username");
    auth2.getAuthDetail().setPassword("password".getBytes());
    dataManager.addAuth(auth2);

    // Add a new Auth
    Auth auth3 = new Auth();
    auth3.setId("id33");
    auth3.setStatus(StatusType.ACTIVE);
    auth3.setAuthDetail(new AuthDetail());
    auth3.getAuthDetail().setType(NBAuthType.IP_WHITE_LIST);
    auth3.getAuthDetail().getWhiteListedIps().add("12.23.45.56");
    auth3.getAuthDetail().getWhiteListedIps().add("45.45.89.65");
    dataManager.addAuth(auth3);
View Full Code Here


            throw new IllegalArgumentException("An authorization with the same IP address already exist");
        }
      }
    }

    AuthDetail authDetail = cachingTableAuthDetails.get(oldAuthToken);
    if (authDetail != null) {

      // Remove all IPs from the table, and add the new one
      if (authDetail.getType() == NBAuthType.IP_WHITE_LIST) {
        for (String ip : authDetail.getWhiteListedIps()) {
          cachingTableAuthIpAddress.remove(ip);
        }
      }
    }

    String authToken = createTokenFromAuth(auth);
    Auth auth2;

    // Check that the token has changed or not
    if (oldAuthToken.equals(authToken) == false) {

      // Check that new token doesn't exist
      auth2 = cachingTableAuth.get(authToken);
      if (auth2 != null)
        throw new IllegalArgumentException("An authorization with the same credentials already exist");

      // If token has changed, update association table
      cachingTableAuthIdToAuthToken.set(auth.getId(), authToken);

      // Remove old auth
      auth2 = cachingTableAuth.remove(oldAuthToken);

      // Remove old details
      cachingTableAuthDetails.remove(oldAuthToken);

    } else {

      auth2 = cachingTableAuth.get(authToken);
      if (auth2 == null)
        throw new IllegalArgumentException("An Authorization with that token doesn't exist");

    }

    auth.setPolicyContexts(auth2.getPolicyContexts());

    if (authDetail != null) {

      // Remove all IPs from the table, and add the new one
      if (authDetail.getType() == NBAuthType.IP_WHITE_LIST) {
        for (String ip : authDetail.getWhiteListedIps()) {
          cachingTableAuthIpAddress.remove(ip);
        }
      }
    }
View Full Code Here

    if (authToken == null)
      throw new InvalidIDException("An Authorization with that ID [" + id + "] doesn't exist");

    cachingTableAuthIdToAuthToken.remove(id);
    Auth auth = cachingTableAuth.remove(authToken);
    AuthDetail authDetail = cachingTableAuthDetails.remove(authToken);

    if (auth == null) {
      throw new InvalidIDException("An Authorization with that token doesn't exist");
    }

    if (authDetail != null) {
      if (authDetail.getType() == NBAuthType.IP_WHITE_LIST) {
        for (String ip : authDetail.getWhiteListedIps()) {
          cachingTableAuthIpAddress.remove(ip);
        }
      }
    }
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

    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

  }

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

    LoadBalancing lb = new LoadBalancing();
    lb.setLoadBalancingType(toDataModel(loadBalancing.getLoadBalancingType()));

    if(loadBalancing.getTargetHealthCheck() != null)
      lb.setTargetHealthCheck(toDataModel(loadBalancing.getTargetHealthCheck()));

    if(loadBalancing.getFailOver() != null)
      lb.setFailOver(toDataModel(loadBalancing.getFailOver()));

    return lb;
  }
View Full Code Here

  }

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

    QuotaRLBucket ids = new QuotaRLBucket();
    ids.getAuthIds().addAll(authIds.getAuthIds());
    ids.setId(authIds.getId());

    return ids;
  }
View Full Code Here

  private static final QuotaRLBucket toDataModel(com.alu.e3.prov.restapi.model.AuthIdsType authIds) {
    if (authIds==null) throw new IllegalArgumentException("authIds must not be null");
    if (authIds.getId()==null) throw new IllegalArgumentException("id must not be null");

    QuotaRLBucket ids = new QuotaRLBucket();
    ids.getAuthIds().addAll(authIds.getAuthIds());
    ids.setId(authIds.getId());

    return ids;
  }
View Full Code Here

    return t;
  }

  private static final SBAuthentication toDataModel(Authentication authentication) {
    if (authentication==null) return null; // throw new IllegalArgumentException("authentication must not be null");
    SBAuthentication s = new SBAuthentication();
    s.setType(authentication.getType());
    for (Key k : authentication.getData().getKey())
      s.getKeys().put(k.getName(), k.getValue());
    return s;
  }
View Full Code Here

  }

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

    TargetHealthCheck thc = new TargetHealthCheck();
    thc.setType(targetHealthCheckType.getType());

    return thc;
  }
View Full Code Here

TOP

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

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.