Update README.md
Brian Kassouf authored 6 years ago
GitHub committed 6 years ago
56 | 56 | |
57 | 57 | In order for the parser and the signer to work, the authorization headers need to be passed between the request and the context. |
58 | 58 | `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. | |
60 | 60 | |
61 | 61 | Example of use in a client: |
62 | 62 | |
63 | 63 | ```go |
64 | 64 | import ( |
65 | stdjwt "github.com/dgrijalva/jwt-go" | |
65 | stdjwt "github.com/dgrijalva/jwt-go" | |
66 | grpctransport "github.com/go-kit/kit/transport/grpc" | |
66 | 67 | |
67 | 68 | "github.com/go-kit/kit/auth/jwt" |
68 | 69 | "github.com/go-kit/kit/endpoint" |
75 | 76 | { |
76 | 77 | jwtSigner := jwt.NewSigner("kid-header", []byte("SigningString"), stdjwt.SigningMethodHS256, jwt.Claims{}) |
77 | 78 | |
78 | options = append(options, httptransport.ClientBefore(jwt.FromGRPCContext())) | |
79 | options = append(options, grpctransport.ClientBefore(jwt.FromGRPCContext())) | |
79 | 80 | exampleEndpoint = grpctransport.NewClient( |
80 | 81 | . // build client endpoint here |
81 | 82 | . |