Documentation
¶
Index ¶
- Constants
- func EncodeResource(hint, id string) string
- func ErrScopeRequired(scopes ...string) *echo.HTTPError
- func GenerateNonce(n int) string
- func GenerateRef(n int) string
- func MustDecodeResource(resource string) (string, string)
- func NewJWTAuthMiddleware(secret string) echo.MiddlewareFunc
- func ParseUnverifiedRawToken(data string) (jwt.MapClaims, error)
- func SignRawToken(claims jwt.MapClaims, secret string) (string, error)
- type Claims
- func (c *Claims) Audience() string
- func (c *Claims) HasScope(scope string) bool
- func (c *Claims) Scopes() []string
- func (c *Claims) Sign(secret string) (string, error)
- func (c *Claims) Subject() string
- func (c *Claims) WithAudience(aud string) *Claims
- func (c *Claims) WithLifetime(ttl time.Duration) *Claims
- func (c *Claims) WithScopes(scopes ...string) *Claims
- func (c *Claims) WithScopesCSV(scopes string) *Claims
- type Scopes
Constants ¶
const ( ScopeUser = "b3scale" ScopeAdmin = "b3scale:admin" ScopeNode = "b3scale:node" ScopeRecordings = "b3scale:recordings" ScopeCallback = "b3scale:callback" )
Scopes
Variables ¶
This section is empty.
Functions ¶
func EncodeResource ¶
EncodeResource associates an ID string with a type hint. Resources can for example be `recordings`, `frontend`, etc...
func ErrScopeRequired ¶
ErrScopeRequired will be returned when a scope is missing from the response.
func GenerateNonce ¶
GenerateNonce will create a random string of length n
func GenerateRef ¶
GenerateRef will create a most likely unique combination of words.
func MustDecodeResource ¶
MustDecodeResource decodes splits a resource token into a type hint and an ID string. If the token is invalid, this function will panic.
func NewJWTAuthMiddleware ¶
func NewJWTAuthMiddleware(secret string) echo.MiddlewareFunc
NewJWTAuthMiddleware creates a new instance of the echojwt middleware. Parameters like shared secrets, public keys, etc.. are retrieved from the environment.
func ParseUnverifiedRawToken ¶ added in v1.1.1
ParseUnverifiedRawToken decodes a token without validating it.
func SignRawToken ¶ added in v1.1.1
SignRawToken creates a token with map claims signed with a secret using the HS256 signing method, because the BBB API specifies this:
https://docs.bigbluebutton.org/development/api/#recording-ready-callback-url
Types ¶
type Claims ¶
type Claims struct {
Scope string `json:"scope"`
jwt.RegisteredClaims
}
Claims extends the JWT standard claims with a well-known `scope` claim.
func NewClaims ¶
NewClaims creates a new set of claims for use with the API. This includes an ID and the subject.
The subject can be any string, however it will be used as an identifier for the 'user' making the request.
func ParseAPIToken ¶
ParseAPIToken validates and parses a JWT token.
func (*Claims) WithAudience ¶
WithAudience adds an audience to the claims.
func (*Claims) WithLifetime ¶
WithLifetime adds a lifetime to the claims.
func (*Claims) WithScopes ¶
WithScopes adds a list of scopes to the claims.
func (*Claims) WithScopesCSV ¶
WithScopesCSV adds a list of scopes to the claims, separated by a delimiter.