本文整理汇总了Java中com.stormpath.sdk.client.Client类的典型用法代码示例。如果您正苦于以下问题:Java Client类的具体用法?Java Client怎么用?Java Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Client类属于com.stormpath.sdk.client包,在下文中一共展示了Client类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: internalInit
import com.stormpath.sdk.client.Client; //导入依赖的package包/类
@Override
protected void internalInit(final WebContext context) {
CommonHelper.assertNotBlank("accessId", accessId);
CommonHelper.assertNotBlank("secretKey", secretKey);
CommonHelper.assertNotBlank("applicationId", applicationId);
try {
final Client client = new Client(new DefaultApiKey(accessId, secretKey));
this.application = client.getDataStore().getResource(
String.format("/applications/%s", applicationId), Application.class);
} catch (final Exception e) {
throw new BadCredentialsException("An exception is caught trying to access Stormpath cloud. " +
"Please verify that your provided Stormpath <accessId>, " +
"<secretKey>, and <applicationId> are correct. Original Stormpath error: " + e.getMessage());
}
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:17,代码来源:StormpathAuthenticator.java
示例2: create
import com.stormpath.sdk.client.Client; //导入依赖的package包/类
@Override
public Application create(Client client, String applicationHref, String applicationName) {
if (applicationName.isEmpty() && applicationHref.isEmpty()) {
throw new IllegalArgumentException(
"Either one of (smt.spring.security.stormpath.application.name) or " +
"(smt.spring.security.stormpath.application.href) must be set."
);
}
if (!applicationHref.isEmpty()) {
return client.getResource(applicationHref, Application.class);
}
return client.getCurrentTenant()
.getApplications(
applicationCriteriaFactory.where(applicationCriteriaFactory.name().eqIgnoreCase(applicationName))
).iterator().next();
}
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:19,代码来源:StormpathApplicationFactory.java
示例3: buildStormpathApplication
import com.stormpath.sdk.client.Client; //导入依赖的package包/类
public Application buildStormpathApplication(Environment env) {
final Properties apiKeyProperties = new Properties();
apiKeyProperties.setProperty(API_KEY_ID, getApiKeyId());
apiKeyProperties.setProperty(API_KEY_SECRET, getApiKeySecret());
// setup stormapth client with apikey properties
ApiKey apiKey = ApiKeys.builder().setProperties(apiKeyProperties).build();
Client client = Clients.builder().setApiKey(apiKey).build();
this.client = client;
// setup stormpath application
Application application = client.getResource(getApiRestUrl(), Application.class);
this.application = application;
// this will initialize stormpath api
StormpathApi.initStormpathApi(application, client);
return application;
}
开发者ID:burakdede,项目名称:dropwizard-stormpath,代码行数:21,代码来源:StormpathClientFactory.java
示例4: doPost
import com.stormpath.sdk.client.Client; //导入依赖的package包/类
@Post
public String doPost(Representation entity) throws IOException {
RestletServer.configureRestForm(getResponse());
String[] body = entity.getText().split("&");
String username = body[0].split("=")[1];
String textpass = body[1].split("=")[1];
String path = "resources/.stormpath/apiKey.properties";
ApiKey apiKey = ApiKeys.builder().setFileLocation(path).build();
Client client = Clients.builder().setApiKey(apiKey).build();
@SuppressWarnings("rawtypes")
AuthenticationRequest request = new UsernamePasswordRequest(username, textpass);
Tenant tenant = client.getCurrentTenant();
ApplicationList applications = tenant.getApplications(
Applications.where(Applications.name().eqIgnoreCase("SOABA Secure")));
Application application = applications.iterator().next();
AuthenticationResult result = application.authenticateAccount(request);
Account account = result.getAccount();
Session newSession = new Session();
newSession.setUserAccount(account);
newSession.setToken(UUID.randomUUID().toString());
config.getSessions().put(newSession.getToken().toString(), newSession);
return toJSON(newSession);
}
开发者ID:jpinho,项目名称:soaba,代码行数:30,代码来源:AuthService.java
示例5: registerApplication
import com.stormpath.sdk.client.Client; //导入依赖的package包/类
@Provides
@Singleton
private Application registerApplication(final Configuration configuration) {
try {
final String apiKeyId = configuration.getString("stormpath.apiKey.id");
final String apiKeySecret = configuration.getString("stormpath.apiKey.secret");
final DefaultApiKey apiKey = new DefaultApiKey(apiKeyId, apiKeySecret);
final Client client = new ClientBuilder().setApiKey(apiKey).build();
final String applicationName = configuration.getString("stormpath.application.name");
final Tenant tenant = client.getCurrentTenant();
Application application = null;
final ApplicationList applications = tenant.getApplications(Applications
.where(Applications.name().eqIgnoreCase(applicationName)));
// Iterator is necessary, to check if the ApplicationsList is empty, because there's no size() method or something equal, in the ApplicationsList class.
final Iterator<Application> iterator = applications.iterator();
if (iterator.hasNext()) {
application = iterator.next();
}
if (application == null) {
application = client.instantiate(Application.class);
application.setName(applicationName);
application = client.getCurrentTenant()
.createApplication(Applications.newCreateRequestFor(application).createDirectory().build());
}
return application;
} catch (Exception e) {
log.error("An error occured while authenticating with Stormpath", e);
}
return null;
}
开发者ID:hivemq,项目名称:hivemq-stormpath-plugin,代码行数:38,代码来源:StormpathPluginModule.java
示例6: setUp
import com.stormpath.sdk.client.Client; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
// Setup our shiro+stormpath+vertx integration
File file = ((VertxInternal) vertx).resolveFile("stormpath.properties");
ApiKey apiKey = ApiKeys.builder().setFileLocation(file.getAbsolutePath()).build();
Client client = Clients.builder().setApiKey(apiKey).build();
ApplicationRealm stormpathAppRealm = new ApplicationRealm();
stormpathAppRealm.setClient(client);
stormpathAppRealm.setApplicationRestUrl("https://api.stormpath.com/v1/applications/2oFtzixwgN0wYKt25euKpg");
authProvider = ShiroAuth.create(vertx, stormpathAppRealm);
}
开发者ID:vert-x3,项目名称:vertx-auth,代码行数:13,代码来源:StormpathTest.java
示例7: application
import com.stormpath.sdk.client.Client; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(Application.class)
public Application application(ApplicationFactory applicationFactory, Client client) {
return applicationFactory.create(client, applicationHref, applicationName);
}
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:6,代码来源:StormpathConfiguration.java
示例8: client
import com.stormpath.sdk.client.Client; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(Client.class)
public Client client() {
return Clients.builder().setApiKey(ApiKeys.builder().setId(apiKeyId).setSecret(apiKeySecret).build()).build();
}
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:6,代码来源:StormpathConfiguration.java
示例9: setUp
import com.stormpath.sdk.client.Client; //导入依赖的package包/类
@Before
public void setUp() {
applicationCriteriaFactory = mock(ApplicationCriteriaFactory.class);
client = mock(Client.class);
factory = new StormpathApplicationFactory(applicationCriteriaFactory);
}
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:7,代码来源:StormpathApplicationFactoryTest.java
示例10: getClient
import com.stormpath.sdk.client.Client; //导入依赖的package包/类
public Client getClient() {
return client;
}
开发者ID:burakdede,项目名称:dropwizard-stormpath,代码行数:4,代码来源:StormpathClientFactory.java
示例11: getStormpathClient
import com.stormpath.sdk.client.Client; //导入依赖的package包/类
public static Client getStormpathClient() {
return stormpathClient;
}
开发者ID:burakdede,项目名称:dropwizard-stormpath,代码行数:4,代码来源:StormpathApi.java
示例12: getClient
import com.stormpath.sdk.client.Client; //导入依赖的package包/类
public static Client getClient() {
return client;
}
开发者ID:IHTSDO,项目名称:OTF-User-Module,代码行数:4,代码来源:ImportExport.java
示例13: setClient
import com.stormpath.sdk.client.Client; //导入依赖的package包/类
public static void setClient(final Client clientIn) {
client = clientIn;
}
开发者ID:IHTSDO,项目名称:OTF-User-Module,代码行数:4,代码来源:ImportExport.java
示例14: getClient
import com.stormpath.sdk.client.Client; //导入依赖的package包/类
public final Client getClient() {
return client;
}
开发者ID:IHTSDO,项目名称:OTF-User-Module,代码行数:4,代码来源:StormPathBaseDTO.java
示例15: setClient
import com.stormpath.sdk.client.Client; //导入依赖的package包/类
public final void setClient(final Client clientIn) {
client = clientIn;
}
开发者ID:IHTSDO,项目名称:OTF-User-Module,代码行数:4,代码来源:StormPathBaseDTO.java
示例16: initStormpathApi
import com.stormpath.sdk.client.Client; //导入依赖的package包/类
/**
* This is where we inject stormpath stormpathApplicaiton instance
*
* @param application Application instance from stormpath
*/
public static void initStormpathApi(Application application, Client client) {
StormpathApi.stormpathClient = client;
StormpathApi.stormpathApplicaiton = application;
}
开发者ID:burakdede,项目名称:dropwizard-stormpath,代码行数:10,代码来源:StormpathApi.java
示例17: create
import com.stormpath.sdk.client.Client; //导入依赖的package包/类
Application create(Client client, String applicationHref, String applicationName);
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:2,代码来源:ApplicationFactory.java
注:本文中的com.stormpath.sdk.client.Client类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论