A Logic Framework for Flexible and Security-Aware Service Composition