Package list golang-github-go-kit-kit / 4c2a022
auth/jwt: add claim factory to example hbc 3 years ago
1 changed file(s) with 7 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
1212 ```go
1313 import (
1414 stdjwt "github.com/dgrijalva/jwt-go"
15
15
1616 "github.com/go-kit/kit/auth/jwt"
1717 "github.com/go-kit/kit/endpoint"
1818 )
2222 {
2323 kf := func(token *stdjwt.Token) (interface{}, error) { return []byte("SigningString"), nil }
2424 exampleEndpoint = MakeExampleEndpoint(service)
25 exampleEndpoint = jwt.NewParser(kf, stdjwt.SigningMethodHS256)(exampleEndpoint)
25 exampleEndpoint = jwt.NewParser(kf, stdjwt.SigningMethodHS256, jwt.StandardClaimsFactory)(exampleEndpoint)
2626 }
2727 }
2828 ```
3434 ```go
3535 import (
3636 stdjwt "github.com/dgrijalva/jwt-go"
37
37
3838 "github.com/go-kit/kit/auth/jwt"
3939 "github.com/go-kit/kit/endpoint"
4040 )
4444 {
4545 exampleEndpoint = grpctransport.NewClient(...).Endpoint()
4646 exampleEndpoint = jwt.NewSigner(
47 "kid-header",
48 []byte("SigningString"),
49 stdjwt.SigningMethodHS256,
47 "kid-header",
48 []byte("SigningString"),
49 stdjwt.SigningMethodHS256,
5050 jwt.Claims{},
5151 )(exampleEndpoint)
5252 }
6666 import (
6767 stdjwt "github.com/dgrijalva/jwt-go"
6868
69 grpctransport "github.com/go-kit/kit/transport/grpc"
69 grpctransport "github.com/go-kit/kit/transport/grpc"
7070 "github.com/go-kit/kit/auth/jwt"
7171 "github.com/go-kit/kit/endpoint"
7272 )