admin

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ISSUER = "https://api.memberstack.com"
View Source
const JWKS_ENDPOINT = "http://member-jwt.s3-website-us-east-1.amazonaws.com/"

Variables

View Source
var (
	ErrBadJwks = errors.New("bad JWKS")
)

Functions

This section is empty.

Types

type MemberstackAdmin

type MemberstackAdmin struct {
	Options Options
	// contains filtered or unexported fields
}

func NewMemberstackAdmin

func NewMemberstackAdmin(o Options) MemberstackAdmin

func (*MemberstackAdmin) GetJwksKeyfunc added in v0.3.0

func (a *MemberstackAdmin) GetJwksKeyfunc() (keyfunc.Keyfunc, error)

GetJwksKeyfunc fetches the JWKS from the HTTP server, parses it into a key function jwt.Parse understands, and caches it on MemberstackAdmin. Subsequent calls returns the cached value.

func (*MemberstackAdmin) GetLatestJwksKeyfunc added in v0.3.0

func (a *MemberstackAdmin) GetLatestJwksKeyfunc() (keyfunc.Keyfunc, error)

GetLatestJwksKeyfunc does the same as GetJwksKeyfunc() but always fetches from the HTTP server, updating the local cache along the way.

func (*MemberstackAdmin) VerifyToken

func (a *MemberstackAdmin) VerifyToken(tokenString string) (*jwt.Token, error)

type MemberstackJwtClaims added in v0.2.0

type MemberstackJwtClaims struct {
	MemberID string `json:"id,omitempty"`
	Type     string `json:"type,omitempty"`
	IsAdmin  bool   `json:"isAdmin,omitempty"`
	jwt.RegisteredClaims
}

func GetMemberstackClaims added in v0.2.0

func GetMemberstackClaims(token *jwt.Token) *MemberstackJwtClaims

GetMemberstackClaims is a utility function to correctly type the verified jwt.Token.Claims to Memberstack-specific JWT format

type Options

type Options struct {
	JWKSEndpoint     string
	Issuer           string
	MemberstackAppId string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL