Documentation ¶
Index ¶
- Constants
- type Claims
- func (claims *Claims) AppAccess(appID string) bool
- func (claims *Claims) AppRight(appID string, right string) bool
- func (claims *Claims) ComponentAccess(componentID string) bool
- func (claims *Claims) ComponentRight(componentID string, right string) bool
- func (claims *Claims) GatewayAccess(gatewayID string) bool
- func (claims *Claims) GatewayRight(gatewayID string, right string) bool
- func (c *Claims) GetIssuer() string
- func (claims *Claims) HasScope(scope string) bool
- type ClaimsWithIssuer
- type ComponentClaims
- type GatewayClaims
Constants ¶
const ( RouterType = "router" BrokerType = "broker" HandlerType = "handler" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Claims ¶
type Claims struct { jwt.StandardClaims Client string `json:"client"` Scope []string `json:"scope"` Type string `json:"type,omitempty"` Apps map[string][]string `json:"apps,omitempty"` Gateways map[string][]string `json:"gateways,omitempty"` Components map[string][]string `json:"components,omitempty"` Username string `json:"username"` Email string `json:"email"` Name struct { First string `json:"first"` Last string `json:"last"` } `json:"name"` }
Claims represents all the claims an access token can have
func FromToken ¶
FromToken uses the tokenkey provider to parse and validate a token into its corresponding claims
func FromTokenWithoutValidation ¶
FromTokenWithoutValidation parses a token into its corresponding claims, without checking the token signature
func (*Claims) AppRight ¶
AppRight checks if the token grants the specified right for the app with the specified ID
func (*Claims) ComponentAccess ¶
ComponentAccess checks if the token grants access to the specified Component
func (*Claims) ComponentRight ¶
ComponentRight checks if the token grants the specified right for the Component with the specified ID
func (*Claims) GatewayAccess ¶
GatewayAccess checks if the token grants access to the specified Gateway
func (*Claims) GatewayRight ¶
GatewayRight checks if the token grants the specified right for the Gateway with the specified ID
type ClaimsWithIssuer ¶
TTNClaims is the interface all claims that are issued by TTN need to adhere to
type ComponentClaims ¶
type ComponentClaims struct { jwt.StandardClaims Type string `json:"type"` }
ComponentClaims represent the claims a network component can have
func FromComponentToken ¶
func FromComponentToken(provider tokenkey.Provider, accessToken string) (*ComponentClaims, error)
FromComponentToken uses the tokenkey provider to parse and validate a token into its corresponding claims
func FromComponentTokenWithoutValidation ¶
func FromComponentTokenWithoutValidation(accessToken string) (*ComponentClaims, error)
FromTokenWithoutValidation parses a token into its corresponding claims, without checking the token signature
func (*ComponentClaims) GetIssuer ¶
func (c *ComponentClaims) GetIssuer() string
GetIssuer returns the issuer of the claims
type GatewayClaims ¶
type GatewayClaims struct { jwt.StandardClaims Type string `json:"type"` LocationPublic bool `json:"location_public"` StatusPublic bool `json:"status_public"` }
GatewayClaims represents all the claims an access token can have
func FromGatewayToken ¶
func FromGatewayToken(provider tokenkey.Provider, gatewayToken string) (*GatewayClaims, error)
FromGatewayToken uses the tokenkey provider to parse and validate a gateway token into its corresponding claims
func FromGatewayTokenWithoutValidation ¶
func FromGatewayTokenWithoutValidation(gatewayToken string) (*GatewayClaims, error)
FromGatewayTokenWithoutValidation parses a token into its corresponding gateway claims, without checking the token signature
func (*GatewayClaims) GetIssuer ¶
func (c *GatewayClaims) GetIssuer() string
Issuer returns the issuer of the claims