christopherrabotin / gin-contrib-headerauth Goto Github PK
View Code? Open in Web Editor NEWMiddleware for the gin web framework. Allows to protect routes with a signature based authentication.
Middleware for the gin web framework. Allows to protect routes with a signature based authentication.
Current code coverage is 96.7%, with line 50 not being covered:
github.com/ChristopherRabotin/gin-contrib-signedauth/signatureauth.go:49.23,51.6 1 0
A simple test for this is adding a Manager which will fail on the DataToSign
function, and test the status is valid.
It could also be of interest to add the coverage profile on the README.
As per the docs, this module would be easier and more idiomatic if the auth manager would be like this:
type MyManager struct{
SomeField interface{}
*signedauth.Manager
}
mgr := &MyManager{{}, signedauth.Manager{AuthPrefix: "EXAMPLE", ...}}
I must check whether it's possible in go then to call a function which the Manager expects, e.g. SecretKey (which will be handled differently depending on the manager), although that function won't be defined by signedauth.Manager.
Use example from https://github.com/gin-gonic/contrib/blob/master/.travis.yml.
Reading the examples provided definitely helps, but a quick start would be much easier. This issue should also detail how we can use header based auth without a signature.
These can be used to set custom headers, but also perform specific actions. Provided parameters will be the Gin context, the access key used, the signature used, the secret, the dataToSign, as well as the error.
These should be sufficient to handle HTTP Basic Auth.
Example: https://github.com/gin-gonic/gin/blob/master/auth.go#L51 .
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.