bind the endpoint to the middleware

- this allows checking this.auth
Merge pull request #1 from dweinstein/middleware-bind

bind the endpoint to the middleware
allow setting a global auth middleware
Merge pull request #2 from dweinstein/middleware-auth-bind-global

Middleware auth bind global