Examples of ApiClient


Examples of com.cosmicpush.app.domain.clients.ApiClient

  public List<ApiClient> getApiClients() {
    return apiClients;
  }
  public ApiClient add(CreateClientAction action) {
    action.validate(new RequestErrors()).assertNoErrors();
    ApiClient apiClient = new ApiClient().create(action);
    apiClients.add(apiClient);
    return apiClient;
  }
View Full Code Here

Examples of com.cosmicpush.app.domain.clients.ApiClient

      throw ApiException.badRequest(String.format("The client name %s already exists.", clientName));
    }

    CreateClientAction action = new CreateClientAction(clientName, clientPassword);

    ApiClient apiClient = account.add(action);
    config.getAccountStore().update(account);

    return Response.seeOther(new URI("manage/api-client/"+apiClient.getClientName())).build();
  }
View Full Code Here

Examples of com.cosmicpush.app.domain.clients.ApiClient

    String accountId = config.getApiClientUser().getAccountId();
    Account account = config.getAccountStore().getByAccountId(accountId);

    String clientName = config.getApiClientUser().getClientName();
    ApiClient apiClient = account.getApiClientByName(clientName);

    return new ApiResource(config, account, apiClient);
  }
View Full Code Here

Examples of com.cosmicpush.app.domain.clients.ApiClient

      Account account = getRequestConfig().getAccountStore().getByClientId(request.getApiClientId());
      if (account == null) {
        throw ApiException.notFound("Account not found given client id " + request.getApiClientId());
      }

      ApiClient apiClient = account.getApiClientById(request.getApiClientId());
      if (apiClient == null) {
        throw ApiException.notFound("API client not found for " + request.getApiClientId());
      }

      if (request.getPushType().isNotification()) {
        String path = String.format("manage/api-client/%s/notifications/%s", apiClient.getClientName(), id);
        return Response.seeOther(new URI(path)).build();

      } else if (request.getPushType().isUserEvent()) {
        String deviceId = request.getUserEventPush().getDeviceId();
        String path = String.format("manage/api-client/%s/user-events/%s", apiClient.getClientName(), deviceId);
        return Response.seeOther(new URI(path)).build();
      }

    }
View Full Code Here

Examples of com.intel.mtwilson.ApiClient

                    p.setProperty("mtwilson.api.ssl.requireTrustedCertificate", WLMPConfig.getConfiguration().getString("mtwilson.api.ssl.requireTrustedCertificate", "true")); // must be secure out of the box!
                    p.setProperty("mtwilson.api.ssl.verifyHostname", WLMPConfig.getConfiguration().getString("mtwilson.api.ssl.verifyHostname", "true")); // must be secure out of the box!
  
                    // Instantiate the API Client object and store it in the session. Otherwise either we need
                    // to store the password in the session or the decrypted RSA key
                    ApiClient rsaApiClient = new ApiClient(baseURL, keystore, new MapConfiguration(p));
       
                    //Storing variable into a session object used while calling into RESt Services.
                    HttpSession session = req.getSession();
                    session.setAttribute("logged-in", true);
                    session.setAttribute("username",username);
View Full Code Here

Examples of com.intel.mtwilson.ApiClient

                        logger.info("Trust Dashboard: mtwilson.api.ssl.policy="+TDPConfig.getConfiguration().getString("mtwilson.api.ssl.policy"));
                        p.setProperty("mtwilson.api.ssl.policy", TDPConfig.getConfiguration().getString("mtwilson.api.ssl.policy", "TRUST_CA_VERIFY_HOSTNAME")); // must be secure out of the box!
                        p.setProperty("mtwilson.api.ssl.requireTrustedCertificate", TDPConfig.getConfiguration().getString("mtwilson.api.ssl.requireTrustedCertificate", "true")); // must be secure out of the box!
                        p.setProperty("mtwilson.api.ssl.verifyHostname", TDPConfig.getConfiguration().getString("mtwilson.api.ssl.verifyHostname", "true")); // must be secure out of the box!
      
                        ApiClient rsaApiClient = new ApiClient(baseURL, keystore, new MapConfiguration(p));
                        X509Certificate[] trustedCertificates = new X509Certificate[0]; // keystore.getTrustedCertificates(SimpleKeystore.SAML);
      
                        //Storing information into a request session. These variables are used in DemoPortalDataController.
                        HttpSession session = req.getSession();
      session.setAttribute("logged-in", true);
View Full Code Here

Examples of com.intel.mtwilson.ApiClient

        return client;
    }

    private ApiClient createClient() throws ClientException, IOException {
        Configuration conf = ConfigurationUtil.getConfiguration(); // tries jvm properties, environment variables, then mtwilson.properties;  you can set location of mtwilson.properties with -Dmtwilson.home=/path/to/dir
        return new ApiClient(conf);
    }
View Full Code Here

Examples of com.intel.mtwilson.ApiClient

*/
public class GetHostTrust extends AbstractCommand {

    @Override
    public void execute(String[] args) throws Exception {
        ApiClient api = getClient();
        HostTrustResponse response = api.getHostTrust(new Hostname(args[0]));
        System.out.println(toJson(response));
    }
View Full Code Here

Examples of common.api.ApiClient

    }
   
    public static void dirs(String path) {
        checkAuthenticity();
        User u = Login.getUser();
        ApiClient client = ApiClientFactory.create(u);
        try {
          renderJSON(client.listDir(path, ApiClient.ListingType.DIRS));
        } catch (NotADirectoryException e) {
            Logger.error(e, "User attempt to list a directory which is infact a file: %s", u);
            renderJSON(Collections.emptyList());
        } catch (InvalidTokenException e) {
            Logger.error(e, "Invalid OAuth token for user %s", u);
View Full Code Here

Examples of common.api.ApiClient

   
    private static InitResult initSortbox(User user) {
        boolean createdSortboxDir = false;
        boolean createdCannedRules = false;
        try {
            ApiClient client = ApiClientFactory.create(user);

            // now get the new sorting folder path for the user and keep going forward
            String sortboxPath = user.sortingFolder;
            if (! client.exists(sortboxPath)) {
                // 1. create missing Sortbox folder
                Logger.info("SortMyBox folder missing for user '%s' at path '%s'",
                          user, sortboxPath);
                createdSortboxDir = client.mkdir(sortboxPath);
                if (createdSortboxDir) {
                    // 2. create canned rules
                    createdCannedRules = createCannedRules(user);
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.