本文整理了Java中com.stormpath.sdk.application.Application
类的一些代码示例,展示了Application
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Application
类的具体详情如下:
包路径:com.stormpath.sdk.application.Application
类名称:Application
[英]An Application instance represents a Stormpath registered application.
[中]应用程序实例表示风暴路径registered application。
代码示例来源:origin: stormpath/stormpath-sdk-java
@RequestMapping("/")
public String hello(HttpServletRequest req) {
return "Hello, " + app.getName();
}
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl
protected ApiAuthenticationResult execute() {
AuthenticationRequest request = FACTORY.createFrom(httpRequest);
AuthenticationResult result = application.authenticateAccount(request);
Assert.isInstanceOf(ApiAuthenticationResult.class, result);
return (ApiAuthenticationResult) result;
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl
public DefaultOAuthClientCredentialsGrantRequestAuthenticator(Application application, DataStore dataStore) {
this(application, dataStore, application.getHref() + OAUTH_TOKEN_PATH);
}
代码示例来源:origin: stormpath/stormpath-sdk-java
log.info("Application: " + application.getHref() + ", " + application.getName());
account = application.createAccount(account);
AccountList accounts = application.getAccounts(queryParams);
account = accounts.iterator().next();
AuthenticationResult result = application.authenticateAccount(request);
account = result.getAccount();
log.info("Authenticated Account: " + account.getUsername() + ", Email: " + account.getEmail());
代码示例来源:origin: stormpath/stormpath-sdk-java
if (app.getName().equalsIgnoreCase("Stormpath")) { //ignore the admin app
continue;
servletContext.setAttribute(STORMPATH_APPLICATION_HREF, single.getHref());
代码示例来源:origin: stormpath/stormpath-sdk-java
application.configureWithProperties(oktaAppConfigMap);
if (Strings.hasText(applicationName)) {
application.setName(applicationName);
if (app.getName().equalsIgnoreCase("Stormpath")) { //ignore the admin app
continue;
代码示例来源:origin: stormpath/stormpath-sdk-java
for (int i = 0; i < 3; i++) {
try {
apiKey = application.getApiKey(id, new DefaultApiKeyOptions().withAccount());
break;
} catch (Exception e) {
log.error("Couldn't get Application ApiKey for " + application.getHref(), e);
if (i == 2) {
throw new RuntimeException(e);
代码示例来源:origin: stackoverflow.com
Client client = Clients.builder().build();
Application application = client.getResource(applicationHref, Application.class);
ProviderAccountRequest request = Providers.GOOGLE.account()
.setCode(code) //where code is the value we obtained in step 8
.build();
ProviderAccountResult result = application.getAccount(request);
System.out.println("Account Email: " + result.getAccount().getEmail());
ProviderData providerData = result.getAccount().getProviderData();
System.out.println("Access Token: " + ((GoogleProviderData)providerData).getAccessToken());
代码示例来源:origin: stormpath/stormpath-sdk-java
/**
* Retrieves the {@link ApiKey} instance pointed by this {@code apiKeyId} and accessible from the {@code
* application}
* <p/>
* The ApiKey is retrieved from the {@link Application} passed as argument.
* <p/>
* This method asserts that the ApiKey retrieved status is {@link ApiKeyStatus#ENABLED} and also that the status of
* the account owner is {@link AccountStatus#ENABLED}
*
* @param application - The application that is making the assertion.
* @param apiKeyId - The id of the {@link ApiKey} embedded in the access token.
*/
private ApiKey getTokenApiKey(Application application, String apiKeyId) {
ApiKey apiKey = application.getApiKey(apiKeyId, new DefaultApiKeyOptions().withAccount());
if (apiKey == null || apiKey.getStatus() == ApiKeyStatus.DISABLED) {
throw ApiAuthenticationExceptionFactory.newOAuthException(AccessTokenOAuthException.class, INVALID_CLIENT);
}
Account account = apiKey.getAccount();
if (account.getStatus() != AccountStatus.ENABLED) {
throw ApiAuthenticationExceptionFactory.newOAuthException(AccessTokenOAuthException.class, INVALID_CLIENT);
}
return apiKey;
}
代码示例来源:origin: dogeared/OZorkAuth
@RequestMapping(value = "/v1/r", method = RequestMethod.POST)
public CommandResponse register(@RequestBody Registration registration) {
if (
registration == null ||
Strings.isNullOrEmpty(registration.getGivenName()) || Strings.isNullOrEmpty(registration.getSurName()) ||
Strings.isNullOrEmpty(registration.getEmail()) || Strings.isNullOrEmpty(registration.getPassword())
) {
throw new RegistrationException("givenName, surName, email and password are all required to register.");
}
Account account = client.instantiate(Account.class);
account
.setEmail(registration.getEmail())
.setPassword(registration.getPassword())
.setGivenName(registration.getGivenName())
.setSurname(registration.getSurName());
account = application.createAccount(account);
CommandResponse res = new CommandResponse();
res.setStatus("SUCCESS");
String[] response = {
"Thank you for registering!",
account.getGivenName() + " " + account.getSurname(),
account.getEmail()
};
res.setResponse(response);
return res;
}
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-servlet
if (app.getName().equalsIgnoreCase("Stormpath")) { //ignore the admin app
continue;
servletContext.setAttribute(STORMPATH_APPLICATION_HREF, single.getHref());
代码示例来源:origin: com.stormpath.spring/stormpath-spring
application.configureWithProperties(oktaAppConfigMap);
if (Strings.hasText(applicationName)) {
application.setName(applicationName);
if (app.getName().equalsIgnoreCase("Stormpath")) { //ignore the admin app
continue;
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-impl
for (int i = 0; i < 3; i++) {
try {
apiKey = application.getApiKey(id, new DefaultApiKeyOptions().withAccount());
break;
} catch (Exception e) {
log.error("Couldn't get Application ApiKey for " + application.getHref(), e);
if (i == 2) {
throw new RuntimeException(e);
代码示例来源:origin: com.stormpath.spring/stormpath-spring-security-webmvc
ProviderAccountResult result = application.getAccount(accountRequest);
Account account = result.getAccount();
return getAuthenticationManager().authenticate(new ProviderAuthenticationToken(account));
代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-oauth
/**
* Retrieves the {@link ApiKey} instance pointed by this {@code apiKeyId} and accessible from the {@code
* application}
* <p/>
* The ApiKey is retrieved from the {@link Application} passed as argument.
* <p/>
* This method asserts that the ApiKey retrieved status is {@link ApiKeyStatus#ENABLED} and also that the status of
* the account owner is {@link AccountStatus#ENABLED}
*
* @param application - The application that is making the assertion.
* @param apiKeyId - The id of the {@link ApiKey} embedded in the access token.
*/
private ApiKey getTokenApiKey(Application application, String apiKeyId) {
ApiKey apiKey = application.getApiKey(apiKeyId, new DefaultApiKeyOptions().withAccount());
if (apiKey == null || apiKey.getStatus() == ApiKeyStatus.DISABLED) {
throw ApiAuthenticationExceptionFactory.newOAuthException(AccessTokenOAuthException.class, INVALID_CLIENT);
}
Account account = apiKey.getAccount();
if (account.getStatus() != AccountStatus.ENABLED) {
throw ApiAuthenticationExceptionFactory.newOAuthException(AccessTokenOAuthException.class, INVALID_CLIENT);
}
return apiKey;
}
代码示例来源:origin: stormpath/stormpath-sdk-java
account = app.createAccount(account);
} else {
final Account[] accountHolder = new Account[]{account};
代码示例来源:origin: stormpath/stormpath-sdk-java
@Bean
public String startupMessage() {
return "Welcome to the '" + stormpathApplication.getName() + "' application!";
}
代码示例来源:origin: stormpath/stormpath-sdk-java
public OAuthAuthenticationResult authenticate(HttpServletRequest httpRequest) {
Assert.notNull(httpRequest, "httpRequest cannot be null.");
Class httpRequestClass = httpRequest.getClass();
if (HttpServletRequest.class.isAssignableFrom(httpRequestClass)) {
this.httpServletRequest = httpRequest;
} else {
throw new IllegalArgumentException(String.format(HTTP_REQUEST_NOT_SUPPORTED_MSG, httpRequest.getClass(), HttpServletRequest.class.getName()));
}
OAuthAuthenticationRequestFactory factory = new OAuthAuthenticationRequestFactory();
AuthenticationRequest request = factory.createFrom(httpServletRequest);
AuthenticationResult result = application.authenticateAccount(request);
Assert.isInstanceOf(OAuthAuthenticationResult.class, result);
return (OAuthAuthenticationResult) result;
}
}
代码示例来源:origin: stormpath/stormpath-sdk-java
public DefaultOAuthRefreshTokenRequestAuthenticator(Application application, DataStore dataStore){
this(application, dataStore, application.getHref() + OAUTH_TOKEN_PATH);
}
代码示例来源:origin: stormpath/stormpath-sdk-java
ProviderAccountResult result = application.getAccount(accountRequest);
Account account = result.getAccount();
return getAuthenticationManager().authenticate(new ProviderAuthenticationToken(account));
内容来源于网络,如有侵权,请联系作者删除!