witoldsz/angular-http-auth — pull request #13 by mbrio (2013-03-21 14:25:38+00:00)
Title: A clearer, more flexible means of ignoring URLs

The previous pull that was accepted into angular-http-auth was flawed in three ways:

1. The naming scheme was terrible, migrated to .when() for configuration which matches Angular's own $httpBackend class in ngMockE2E
2. When ignoring URLs it still fires the auth-loginRequired event
3. The previous configuration was pretty flexible but with the lack of a deferred object passed to the handler it was unable to modify the behavior. This is best explained in an example. You most likely would want a 401 to be ignored from a login form. In the previous configuration you would add that URL to the ignore list. Because the deferred object was not rejected you could not handle the error from the login form through the $http.get().error() method because the deferred object was not rejected. With this new configuration you could reject the deferred object and thereby allowing the controller to display an error message like "Incorrect Credentials"

You can see an example of this in practice: https://github.com/qloo/angular-authentication, be sure to bower install to get the dependencies in and view the example/index.html file.