Codebase list golang-github-go-kit-kit / 3845256
Update README.md Brian Kassouf authored 6 years ago GitHub committed 6 years ago
1 changed file(s) with 4 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
5656
5757 In order for the parser and the signer to work, the authorization headers need to be passed between the request and the context.
5858 `ToHTTPContext()`, `FromHTTPContext()`, `ToGRPCContext()`, and `FromGRPCContext()` are given as helpers to do this.
59 These function impliment the correlating transport's RequestFunc interface and can be passes as ClientBefore or ServerBefore options.
59 These function impliment the correlating transport's RequestFunc interface and can be passed as ClientBefore or ServerBefore options.
6060
6161 Example of use in a client:
6262
6363 ```go
6464 import (
65 stdjwt "github.com/dgrijalva/jwt-go"
65 stdjwt "github.com/dgrijalva/jwt-go"
66 grpctransport "github.com/go-kit/kit/transport/grpc"
6667
6768 "github.com/go-kit/kit/auth/jwt"
6869 "github.com/go-kit/kit/endpoint"
7576 {
7677 jwtSigner := jwt.NewSigner("kid-header", []byte("SigningString"), stdjwt.SigningMethodHS256, jwt.Claims{})
7778
78 options = append(options, httptransport.ClientBefore(jwt.FromGRPCContext()))
79 options = append(options, grpctransport.ClientBefore(jwt.FromGRPCContext()))
7980 exampleEndpoint = grpctransport.NewClient(
8081 . // build client endpoint here
8182 .