use of org.forgerock.openam.sts.user.invocation.STSIssuedTokenState in project OpenAM by OpenRock.
the class CTSTokenPersistenceImpl method listTokens.
@Override
public List<STSIssuedTokenState> listTokens(QueryFilter<CoreTokenField> queryFilter) throws CTSTokenPersistenceException {
Collection<PartialToken> partialTokens;
try {
partialTokens = ctsPersistentStore.attributeQuery(buildTokenFilter(queryFilter));
} catch (CoreTokenException e) {
throw new CTSTokenPersistenceException(ResourceException.INTERNAL_ERROR, e.getMessage(), e);
}
List<STSIssuedTokenState> issuedTokens = new ArrayList<>(partialTokens.size());
for (PartialToken partialToken : partialTokens) {
issuedTokens.add(marshalIssuedTokenState(partialToken));
}
return issuedTokens;
}
use of org.forgerock.openam.sts.user.invocation.STSIssuedTokenState 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