public void connectToStormpath() { if (builder == null) { this.builder = Clients.builder(); Properties properties = new Properties(); properties.setProperty("apiKey.id", "3OIJT00DLSL8BQ3UCLR5X6C6S"); properties.setProperty("apiKey.secret", "CGMCI0ul9ZR3hDiDIvcocccav3KOKcpHZ2doeqUm1i8"); ApiKey apiKey = ApiKeys.builder().setProperties(properties).build(); this.client = Clients.builder().setApiKey(apiKey).build(); this.tenant = client.getCurrentTenant(); this.applications = tenant.getApplications(Applications.where(Applications.name().eqIgnoreCase("sQuire"))); this.app = applications.iterator().next(); } }
public Client getClient() { ApiKey apiKey = ApiKeys.builder().setFileLocation(path).build(); com.stormpath.sdk.client.Client client = Clients.builder().setApiKey(apiKey).build(); System.out.println(client.getCurrentTenant().getName()); return client; }