common

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 29, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WebUsage used for the uid
	WebUsage = "web"
	// StorageUsage for file retrieval
	StorageUsage = "storage"
	// APIUSage for the device api
	APIUSage = "api"
)

Variables

This section is empty.

Functions

func ClaimsFromToken

func ClaimsFromToken(claim jwt.Claims, token string, key []byte) error

ClaimsFromToken parses the claims from the token

func GetToken

func GetToken(c *gin.Context) (string, error)

GetToken gets the token from the headers

func SignClaims

func SignClaims(claims jwt.Claims, key []byte) (string, error)

SignClaims signs the claims i.e. creates a token

Types

type Auth0profile

type Auth0profile struct {
	UserID        string `json:"UserID"`
	IsSocial      bool
	ClientID      string `json:"ClientID"`
	Connection    string
	Name          string `json:"Name"`
	Nickname      string `json:"NickName"`
	GivenName     string
	FamilyName    string
	Email         string
	EmailVerified bool
	Picture       string
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

Auth0profile is the oauth user struct.

type CodeConnector

type CodeConnector interface {
	//NewCode generates one time code for a user
	NewCode(uid string) (code string, err error)

	//ConsumeCode a code and returns the uid if ofound
	ConsumeCode(code string) (uid string, err error)
}

CodeConnector matches a code to users

type DeviceClaims

type DeviceClaims struct {
	UserID     string `json:"auth0-userid"`
	DeviceDesc string `json:"device-desc"`
	DeviceID   string `json:"device-id"`
	Scopes     string `json:"scopes,omitempty"`
	jwt.StandardClaims
}

DeviceClaims device

type StorageClaim

type StorageClaim struct {
	DocumentID string `json:"documentId"`
	UserID     string `json:"userId"`
	jwt.StandardClaims
}

StorageClaim used for file retrieval

type UserClaims

type UserClaims struct {
	Profile    Auth0profile `json:"auth0-profile,omitempty"`
	DeviceDesc string       `json:"device-desc"`
	DeviceID   string       `json:"device-id"`
	Scopes     string       `json:"scopes,omitempty"`
	jwt.StandardClaims
}

UserClaims is the oauth token struct.

type WebUserClaims

type WebUserClaims struct {
	UserID string `json:"UserID"`
	Email  string
	Scopes string `json:"scopes,omitempty"`
	Roles  []string
	jwt.StandardClaims
}

WebUserClaims the claims

Jump to

Keyboard shortcuts

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