use of tech.aroma.thrift.exceptions.InvalidTokenException in project aroma-data-operations by RedRoma.
the class CassandraTokenRepository method tryToConvertRowToToken.
private AuthenticationToken tryToConvertRowToToken(Row row) throws OperationFailedException, InvalidTokenException {
AuthenticationToken token;
try {
token = tokenMapper.apply(row);
} catch (Exception ex) {
LOG.error("Could not map Row {} to Token", row, ex);
throw new OperationFailedException("Failed to query for Token: " + ex.getMessage());
}
checkThat(token).throwing(InvalidTokenException.class).is(completeToken());
return token;
}
use of tech.aroma.thrift.exceptions.InvalidTokenException in project aroma-data-operations by RedRoma.
the class TokenRepository method doesTokenBelongTo.
default boolean doesTokenBelongTo(@NonEmpty String tokenId, @NonEmpty String ownerId) throws InvalidTokenException, TException {
checkThat(tokenId, ownerId).throwing(InvalidArgumentException.class).usingMessage("tokenId and ownerId are required").are(nonEmptyString());
AuthenticationToken token = this.getToken(tokenId);
checkThat(token).throwing(InvalidTokenException.class).is(tokenContainingOwnerId());
return Objects.equals(ownerId, token.ownerId);
}
Aggregations