@Override public Account getAccount() { return apiKey.getAccount(); }
@Override public Account getAccount() { return apiKey.getAccount(); }
@Override public Account getAccount() { return this.primary.getAccount(); }
@Override public Account getAccount() { return getApiKey().getAccount(); }
@Override public Account getAccount() { return getApiKey().getAccount(); }
final Account account = apiKey.getAccount();
final Account account = apiKey.getAccount();
Account account = apiKey.getAccount();
Account account = apiKey.getAccount();
/** * 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; }
/** * 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; }
protected ApiKey getEnabledApiKey(HttpServletRequest request, String apiKeyId) throws InvalidApiKeyException, DisabledApiKeyException, DisabledAccountException { Application app = getApplication(request); ApiKey apiKey = app.getApiKey(apiKeyId); if (apiKey == null) { throw new InvalidApiKeyException(newError("apiKey is invalid.")); } if (apiKey.getStatus() != ApiKeyStatus.ENABLED) { throw new DisabledApiKeyException(newError("apiKey is disabled.")); } Account account = apiKey.getAccount(); AccountStatus status = account.getStatus(); if (status != AccountStatus.ENABLED) { throw new DisabledAccountException(newError("account is disabled."), status); } return apiKey; }
protected ApiKey getEnabledApiKey(HttpServletRequest request, String apiKeyId) throws InvalidApiKeyException, DisabledApiKeyException, DisabledAccountException { Application app = getApplication(request); ApiKey apiKey = app.getApiKey(apiKeyId); if (apiKey == null) { throw new InvalidApiKeyException(newError("apiKey is invalid.")); } if (apiKey.getStatus() != ApiKeyStatus.ENABLED) { throw new DisabledApiKeyException(newError("apiKey is disabled.")); } Account account = apiKey.getAccount(); AccountStatus status = account.getStatus(); if (status != AccountStatus.ENABLED) { throw new DisabledAccountException(newError("account is disabled."), status); } return apiKey; }