revised containsEndpoint to match the much more complicated reality
Now cleaner
Added the authorization check and the tests to go with it