go-chi / oauth Goto Github PK
View Code? Open in Web Editor NEWOAuth 2.0 middleware service for chi (ported from gin by community member)
License: MIT License
OAuth 2.0 middleware service for chi (ported from gin by community member)
License: MIT License
Are there helper functions for retrieving the claims and scope from the request context? They can be fetched without them, but it feels fragile.
Adding helper functions would make the values easier to retrieve.
Hi, we're a new user of this module, which is great. Thanks a lot to the maintainers.
It seems pretty stable; isn't it a good time to tag it in order to ease its maintenance via go modules?
After adding the middleware router.Use(oauth.Authorize("mySecretKey-10101", nil))
and being able to authorize a user, I had some issues figuring out how to access the information of the access token using the Context.
The middleware.go file adds the token information to the Context using a new type that is basically a string. Code in question:
`type contextKey string
const (
CredentialContext contextKey = "oauth.credential"
ClaimsContext contextKey = "oauth.claims"
ScopeContext contextKey = "oauth.scope"
TokenTypeContext contextKey = "oauth.tokentype"
AccessTokenContext contextKey = "oauth.accesstoken"
)`
Given that the context is accessed using r.Context().Value(key)
and that key is basically a string, I thought I had to access the claims just by using r.Context().Value("oauth.claims")
but this approach returned nil.
To successfully access the token information in the context I had to import the oauth package and use the consts that I put above since their type is not a string but contextKey. Working Example:
r.Context().Value(oauth.ClaimsContext)
I was wondering why this contextKey type is used instead of using a string
Currently tokens are signed using only one crypto algorithm. Please add RSA and ECDSA algorithms as symmetric crypto keys are not really suitable for OAuth
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.