use of org.forgerock.openam.sts.CTSTokenPersistenceException in project OpenAM by OpenRock.
the class TokenGenerationService method queryCollection.
@Override
public Promise<QueryResponse, ResourceException> queryCollection(final Context serverContext, final QueryRequest queryRequest, final QueryResourceHandler queryResultHandler) {
QueryFilter<JsonPointer> queryFilter = queryRequest.getQueryFilter();
if (queryFilter == null) {
return new BadRequestException(getUsageString()).asPromise();
}
try {
final QueryFilter<CoreTokenField> coreTokenFieldQueryFilter = convertToCoreTokenFieldQueryFilter(queryFilter);
final List<STSIssuedTokenState> issuedTokens = ctsTokenPersistence.listTokens(coreTokenFieldQueryFilter);
for (STSIssuedTokenState tokenState : issuedTokens) {
queryResultHandler.handleResource(newResourceResponse(tokenState.getTokenId(), EMPTY_STRING, tokenState.toJson()));
}
return newResultPromise(newQueryResponse());
} catch (CTSTokenPersistenceException e) {
logger.error("Exception caught obtaining list of sts-issued tokens: " + e, e);
return e.asPromise();
}
}
Aggregations