github.com/namsral/multipass (go): Package multipass implements an authentication service which can be used to wrap any http.Handler(Func).  Multipass implements the concept to authenticate users based on something they own instead of something they know. This is better known as the second factor of Two-factor Authentication.  Wrap any http.Handler or http.HandlerFunc to provide user authentication. In the example below, the appHandler function is wrapped using the AuthHandler wrapper. It assumes you have a SMTP service running on `localhost:2525` and user identified by email address leeloo@dallas has access to the resource at `/private`.  The package consist of three major components; Multipass, ResourceHandler and UserService.  Multipass is a http.Handler which issues and signs user tokens and validates their signature.  Multipass has it's own web UI which is available at the configurable basepath. From the web UI users can request a login url to gain access to private resources.  User authorization is offloaded to the UserService service. Because the UserService is an interface custom UserService's can be developed and plugged into the Multipass instance. Allowing other means of authentication and authorization besides the built-in email UserService.  An implementation can be found in the `services/email` package. This implementations identifies users by their email address.  ResourceHandler accepts a http.ResponseWriter and http.Request and determines if the request is from an authenticated user and if this user is authorized to access the requested resource according to the UserService. The ResourceHandler extracts any user token from the header, cookie header or query parameters and validates the user tokens signature with preset or pre-generated key pairs.
Keywords: authentication|caddy|http|reverse-proxy|two-factor