Documentation ¶
Index ¶
- Variables
- func Decode(pemEncoded string) *ecdsa.PrivateKey
- func Encode(privateKey *ecdsa.PrivateKey) string
- func FromBase58(key string) (*ecdsa.PrivateKey, error)
- func New() (*ecdsa.PrivateKey, *ecdsa.PublicKey)
- func NewBase58Key() string
- type AuthInterceptor
- type AuthorizeFn
- type JWTManager
- type RoleClaims
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Decode ¶
func Decode(pemEncoded string) *ecdsa.PrivateKey
func Encode ¶
func Encode(privateKey *ecdsa.PrivateKey) string
func FromBase58 ¶
func FromBase58(key string) (*ecdsa.PrivateKey, error)
func NewBase58Key ¶
func NewBase58Key() string
Types ¶
type AuthInterceptor ¶
type AuthInterceptor struct { Authorizer AuthorizeFn // contains filtered or unexported fields }
func NewAuthInterceptor ¶
func NewAuthInterceptor(Authorizer AuthorizeFn) *AuthInterceptor
func (*AuthInterceptor) Stream ¶
func (i *AuthInterceptor) Stream() grpc.StreamServerInterceptor
func (*AuthInterceptor) Unary ¶
func (i *AuthInterceptor) Unary() grpc.UnaryServerInterceptor
type AuthorizeFn ¶
func DefaultAuthorizer ¶
func DefaultAuthorizer(jwtManager *JWTManager, accessibleRoles map[string][]string) AuthorizeFn
type JWTManager ¶
type JWTManager struct {
// contains filtered or unexported fields
}
func NewJWTManager ¶
func NewJWTManager(secretKey string, tokenDuration time.Duration) (*JWTManager, error)
func (*JWTManager) Verify ¶
func (m *JWTManager) Verify(token string) (*RoleClaims, error)
type RoleClaims ¶
type RoleClaims struct { jwt.StandardClaims Roles []string `json:"roles"` }
func (*RoleClaims) IsAuthorized ¶
func (r *RoleClaims) IsAuthorized(role string) bool
func (*RoleClaims) String ¶
func (r *RoleClaims) String() string
Click to show internal directories.
Click to hide internal directories.