models

package
v0.0.0-...-c131d26 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TokenState_name = map[int32]string{
	0: "WATCH",
	1: "LOGOUT",
	2: "TRACEROUTE",
	3: "FREEZE",
	4: "UNFREEZE",
}
View Source
var TokenState_value = map[string]int32{
	"WATCH":      0,
	"LOGOUT":     1,
	"TRACEROUTE": 2,
	"FREEZE":     3,
	"UNFREEZE":   4,
}

Functions

This section is empty.

Types

type AccessDetails

type AccessDetails struct {
	AccessUuid  string `json:"access_uuid,omitempty"`
	RefreshUUID string `json:"refresh_uuid,omitempty"`
	UserId      uint64 `json:"user_id"`
}

type AccessTokens

type AccessTokens struct {
	AccessToken  string `json:"access_token,omitempty"`
	RefreshToken string `json:"refresh_token"`
}

type ResponseObject

type ResponseObject struct {
	Error   string        `json:"error,omitempty"`
	Code    int           `json:"code,omitempty"`
	Tokens  *AccessTokens `json:"tokens,omitempty"`
	Token   string        `json:"token,omitempty"`
	Message string        `json:"message,omitempty"`
}

ResponseObject ... general response object

type ServiceAccess

type ServiceAccess struct {
	UserID uint64         `json:"id,omitempty"`
	Status TokenStatus    `json:"status,omitempty"`
	Claims *jwt.MapClaims `json:"claims,omitempty"`
}

type ServiceError

type ServiceError struct {
	Error string `json:"error,omitempty"`
	Code  int    `json:"code,omitempty"`
}

type ServiceRequest

type ServiceRequest struct {
	UserID  uint64      `json:"user_id"`
	Payload interface{} `json:"payload,omitempty"`
}

type TokenAffectRequest

type TokenAffectRequest struct {
	Token        string     `json:"token"`
	DesiredState TokenState `json:"desired_state,omitempty"`
}

type TokenAffectResponse

type TokenAffectResponse struct {
	EffectApplied bool          `json:"effect_applied,omitempty"`
	Message       string        `json:"message,omitempty"`
	Error         *ServiceError `json:"error,omitempty"`
}

type TokenClaim

type TokenClaim struct {
	Claim string      `json:"claim"`
	Value interface{} `json:"value"`
}

type TokenDetails

type TokenDetails struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	AccessUUID   string `json:"access_uuid"`
	RefreshUUID  string `json:"refresh_uuid"`
	AtExpiry     int64  `json:"at_expiry"`
	RtExpiry     int64  `json:"rt_expiry"`
}

type TokenState

type TokenState int32
const (
	TokenState_WATCH      TokenState = 0
	TokenState_LOGOUT     TokenState = 1
	TokenState_TRACEROUTE TokenState = 2
	TokenState_FREEZE     TokenState = 3
	TokenState_UNFREEZE   TokenState = 4
)

type TokenStatus

type TokenStatus int32
const (
	TokenStatus_INVALID    TokenStatus = 0
	TokenStatus_AUTHORIZED TokenStatus = 1
	TokenStatus_RESTRICTED TokenStatus = 2
	TokenStatus_EXPIRED    TokenStatus = 3
)

type TokenVerifyResponse

type TokenVerifyResponse struct {
	Access ServiceAccess `json:"access,omitempty"`
	Error  ServiceError  `json:"error,omitempty"`
}

func (*TokenVerifyResponse) MapClaims

func (c *TokenVerifyResponse) MapClaims() map[string]string

Maps the claims from the request to be encoded in the jwt

type User

type User struct {
	ID       uint64                 `json:"id"`
	Username string                 `json:"email"`
	Password string                 `json:"password"`
	PII      UserPII                `json:"details,omitempty"`
	Claims   map[string]interface{} `json:"claims,omitempty"`
	Error    string                 `json:"error,omitempty"`
	Code     int                    `json:"code,omitempty"`
}

func (*User) MapClaims

func (c *User) MapClaims() map[string]string

Maps the claims from the request to be encoded in the jwt

type UserPII

type UserPII struct {
	Mobile    string `json:"mobile,omitempty"`
	FirstName string `json:"first_name,omitempty"`
	LastName  string `json:"last_name,omitempty"`
}

Jump to

Keyboard shortcuts

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