
net.smartcosmos.extension.stormpath.util.StormpathInitializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of smartcosmos-user-details-stormpath Show documentation
Show all versions of smartcosmos-user-details-stormpath Show documentation
Retrieves User Detail Information for use in Authentication from Stormpath
The newest version!
package net.smartcosmos.extension.stormpath.util;
import com.stormpath.sdk.api.ApiKey;
import com.stormpath.sdk.api.ApiKeys;
import com.stormpath.sdk.application.Application;
import com.stormpath.sdk.application.ApplicationList;
import com.stormpath.sdk.application.Applications;
import com.stormpath.sdk.client.Client;
import com.stormpath.sdk.client.Clients;
import com.stormpath.sdk.tenant.Tenant;
import net.smartcosmos.extension.stormpath.config.StormpathProperties;
public class StormpathInitializer {
public static ApiKey getApiKeyFromProperties(StormpathProperties.ApiKey apiKeyProperties) {
return ApiKeys.builder()
.setId(apiKeyProperties.getId())
.setSecret(apiKeyProperties.getSecret())
.build();
}
public static Client getClientFromProperties(StormpathProperties.ApiKey apiKeyProperties) {
ApiKey apiKey = getApiKeyFromProperties(apiKeyProperties);
return Clients.builder()
.setApiKey(apiKey)
.build();
}
public static Application getSingleApplication(Tenant tenant, String applicationName) {
ApplicationList applications = tenant.getApplications(
Applications.where(Applications.name()
.eqIgnoreCase(applicationName)));
return applications.single();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy