Documentation ¶
Index ¶
- Variables
- type Claims
- type JWTClient
- func (j *JWTClient) Authorized(t *Token, perms ...PermFunc) error
- func (j *JWTClient) AuthorizedGrpc(ctx context.Context, perms ...PermFunc) error
- func (j *JWTClient) AuthorizedHandler(handler http.Handler, perms ...PermFunc) http.Handler
- func (j *JWTClient) ParseToken(token string) (*Token, error)
- func (j *JWTClient) ParseTokenContext(ctx context.Context) (*Token, error)
- func (j *JWTClient) ParseTokenHeader(r *http.Request) (*Token, error)
- func (j *JWTClient) ParseTokenReader(reader io.ReadCloser) (*Token, error)
- func (j *JWTClient) PublicKey() *rsa.PublicKey
- func (j *JWTClient) PublicKeyPEM() []byte
- type JWTClientOption
- type JWTServer
- type JWTServerOption
- type PermFunc
- type PolicyFunc
- type SigningAlgo
- type Token
Constants ¶
This section is empty.
Variables ¶
View Source
var ( RS256 = jwt.SigningMethodRS256 RS384 = jwt.SigningMethodRS384 RS512 = jwt.SigningMethodRS512 )
Functions ¶
This section is empty.
Types ¶
type JWTClient ¶
type JWTClient struct {
// contains filtered or unexported fields
}
func NewJWTClient ¶
func NewJWTClient(options ...JWTClientOption) (*JWTClient, error)
func (*JWTClient) AuthorizedGrpc ¶
func (*JWTClient) AuthorizedHandler ¶
func (*JWTClient) ParseTokenContext ¶
func (*JWTClient) ParseTokenHeader ¶
func (*JWTClient) ParseTokenReader ¶
func (j *JWTClient) ParseTokenReader(reader io.ReadCloser) (*Token, error)
func (*JWTClient) PublicKeyPEM ¶
type JWTClientOption ¶
func WithLoadPublicKey ¶
func WithLoadPublicKey(publicKeyFile string) JWTClientOption
func WithPublicKey ¶
func WithPublicKey(publicKey []byte) JWTClientOption
type JWTServer ¶
type JWTServer struct { *JWTClient // contains filtered or unexported fields }
func NewJWTServer ¶
func NewJWTServer(signingAlgo SigningAlgo, expiration time.Duration, skew time.Duration, options ...JWTServerOption) (*JWTServer, error)
func (*JWTServer) NewToken ¶
func (j *JWTServer) NewToken(u *auth.User, policies ...PolicyFunc) *Token
func (*JWTServer) PrivateKey ¶
func (j *JWTServer) PrivateKey() *rsa.PrivateKey
func (*JWTServer) PrivateKeyPEM ¶
func (*JWTServer) RenewToken ¶
type JWTServerOption ¶
func WithKeys ¶
func WithKeys(privateKey []byte, publicKey []byte) JWTServerOption
func WithLoadKeys ¶
func WithLoadKeys(privateKeyFile string, publicKeyFile string) JWTServerOption
type PolicyFunc ¶
type PolicyFunc func(c *Claims)
type SigningAlgo ¶
type SigningAlgo *jwt.SigningMethodRSA
type Token ¶
type Token struct { SignedToken string *jwt.Token }
func LoadSignedToken ¶
func (*Token) GetRequestMetadata ¶
func (*Token) RequireTransportSecurity ¶
Click to show internal directories.
Click to hide internal directories.