Comments (6)
Thanks for raising this, here is an example until docs get added:
spec := &jwt.Specification{
AllowParam: false,
AuthOptions: false,
TTLMinutes: 1440,
Issuer: "api.xordataexchange.com",
KeySigningMethod: jwt.RSA256,
SigningKeyFunc: privateKey,
ValidationFunc: pubKey,
}
service.Use(jwt.Middleware(spec))
tm := jwt.NewTokenManager(spec)
You can then use tm
to create tokens. Obviously this is just an example, your code may be organized differently.
from goa.
I presume service.Use(jwt.Middleware(spec)) will wrap all API endpoints in jwt and would require token. How would I exclude i.e. /auth/login which would be used for authenticating and then generating tokens for client?
from goa.
That's correct. You can mount middlewares on specific controllers instead of service wide.
from goa.
Brilliant thanks !
BTW great project !
from goa.
Thank you! I'll leave this issue opened until we have proper docs for the JWT middleware.
from goa.
The package is now properly documented. Thanks for the report.
from goa.
Related Issues (20)
- Request - additional command line parameters for generation HOT 4
- OpenAPI response may be declared even though Result is empty HOT 1
- Duplicate function definitions to implement the OneOf in generated code when using Meta("struct:pkg:path", "types")
- Is there a nice way to integrate AsyncAPI into goa? HOT 1
- Make endpointsData public HOT 1
- goa gen only generating structs for types contained in service definitions HOT 1
- Upstream indirect dependency change HOT 6
- Meta openapi:example still generates example if put at API level HOT 1
- Goa not enforcing required attribute HOT 6
- grpc stream.Recv doesn't decode errors HOT 1
- can't use SkipRequestBodyEncodeDecode and authentification at the same time HOT 7
- Shouldn't body be closed by decoder ? HOT 12
- proto file(s) should be named with package name not service name (if package name defined)
- goa gen results in "package src/goa-test/calc is not in std" HOT 1
- chi: wildcard '*' must be the last value in a route. trim trailing text or use a '{param}' instead HOT 6
- objects HOT 1
- Meta("struct:pkg:path", "foo/bar") doesn't work. HOT 9
- how to return an existing type plus additional cookies ? HOT 6
- Method with SkipRequestBodyEncodeDecode and without payload generates invalid client
- setting the accept header doesn't seem to work HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goa.