An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 9.0% on proxy.golang.org

proxy.golang.org : github.com/lauslim12/basic

Package basic provides plug and play, generic, secure, easy to use, customizable, and painless Basic Authentication for Go's HTTP handlers. This package tries its best to implement all specifications in a customizable way as specified in [RFC 7617](https://datatracker.ietf.org/doc/html/rfc7617), the newest version of Basic Authentication which obsoletes [RFC 2617](https://datatracker.ietf.org/doc/html/rfc2617). Basic Authentication itself is a simple and secure way to protect your API endpoints. However, for it to be completely secure, you have to augment the authentication by using SSL/TLS. You may use hashes / encryption in advance, but I think it's not necessary. SSL/TLS provides excellent security as long as you can trust your Certificate Authority and can ensure your connections are end-to-end encrypted, no sniffers or spoofers whatsoever. In order to use this package, you have to instantiate a new `BasicAuth` instance before hooking it to a handler. You can set various configurations, such as the authenticator function, charset (if using non-standard, other than UTF-8 charset), invalid credentials response, invalid scheme response, custom realm, and static users if applicable. If you want to do anything with the `*http.Request` struct, it is recommended for you to process it in a previous custom middleware before implementing your authentication with this library. This package tries its best to be as generic as possible, so you can definitely use any web framework or customized handlers as long as it conforms to the main interface (`http.Handler`). As a note about the `BasicAuth` attributes, you may use the authenticator function in order to perform a more sophisticated authentication logic, such as pulling your user based on their username from the database. Another thing to note is that you can pass `nil` or `make(map[string]string)` to the `Users` attribute if you do not need static credentials. Finally, the `WWW-Authenticate` header is only sent if both `Charset` and `Realm` are set. `Users` attribute is a 1-to-1 mapping of username and password. See example in `example/main.go`.

Registry - Source - Documentation - JSON - codemeta.json
purl: pkg:golang/github.com/lauslim12/basic
Keywords: api , basic-authentication , go , http , library , rfc7617
License: MIT
Latest release: about 3 years ago
First release: almost 4 years ago
Namespace: github.com/lauslim12
Stars: 0 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 25 days ago

    Loading...
    Readme
    Loading...