addedeffect: go.aporeto.io/addedeffect/tokenutils Index | Files

package tokenutils

import "go.aporeto.io/addedeffect/tokenutils"

Package tokenutils contains various utilities used to interact with Aporeto JWTs.

Index

Package Files

audience.go doc.go tokenutils.go

Constants

const AudienceAny = "*"

AudienceAny represents any operation, identity or namespace.

func ExtractQuota Uses

func ExtractQuota(token string) (int, error)

ExtractQuota extracts the eventual quota from a token. Not that the token is not verified in the process, you the verification must be done before trusting the extracted quota value.

func SigAlg Uses

func SigAlg(token string) (string, error)

SigAlg returns the signature used by the token

func Snip Uses

func Snip(err error, token string) error

Snip snips the given token from the given error.

func UnsecureClaimsMap Uses

func UnsecureClaimsMap(token string) (claims map[string]interface{}, err error)

UnsecureClaimsMap decodes the claims in the given JWT token without verifying its validity. Only use or trust this after proper validation.

type Audience Uses

type Audience struct {
    Operations []string
    Identities []string
    Namespaces []string
}

Audience represents a parsed audience string.

func (Audience) String Uses

func (a Audience) String() string

func (Audience) Verify Uses

func (a Audience) Verify(operation elemental.Operation, identity elemental.Identity, namespace string) bool

Verify verifies the audience is valid for the given operation, identity and namespace.

type AudiencesList Uses

type AudiencesList []Audience

AudiencesList is a list of audiences.

func ParseAudience Uses

func ParseAudience(audString string, modelManager elemental.ModelManager) (AudiencesList, error)

ParseAudience parses the audience string and returns an AudiencesList.

func UnsecureAudience Uses

func UnsecureAudience(token string, modelManager elemental.ModelManager) (AudiencesList, error)

UnsecureAudience extracts the audience list from a token string without verifying its validity. Only use or trust this after proper validation.

func (AudiencesList) String Uses

func (a AudiencesList) String() string

func (AudiencesList) Verify Uses

func (a AudiencesList) Verify(operation elemental.Operation, identity elemental.Identity, namespace string) bool

Verify verifies at least one audience in the list is valid for the given operation, identity and namespace.

Package tokenutils imports 6 packages (graph). Updated 2019-05-01. Refresh now. Tools for package owners.