Documentation ¶
Index ¶
Constants ¶
View Source
const ( XRHIDENTITY = "x-rh-identity" LAST_VISITED_MAX = 10 IDENTITY_CTX_KEY = "identity" USER_CTX_KEY = "user" GET_ALL_PARAM = "getAll" // Used for searching ALL favorited pages DEFAULT_PARAM = "archived" // Used as default value for active favorited pages FAVORITE_PARAM = "favorite" )
View Source
const ProjectName = "chrome-service-backend"
Variables ¶
View Source
var (
ErrNotAuthorized = errors.New("not authorized")
)
Functions ¶
func InitUserIdentitiesCache ¶
func InitUserIdentitiesCache()
Types ¶
type CacheEntry ¶
type CacheEntry struct { ExpireAt time.Time Identity models.UserIdentity }
type DecodedToken ¶
type DecodedToken struct { UserId string `json:"user_id"` OrgId string `json:"org_id"` AccountNumber string `json:"account_number"` Username string `json:"username"` }
func ParseJWTToken ¶
func ParseJWTToken(tokenString string) (DecodedToken, error)
Adaptation of chrome UI token parsing as we can't yse the JWT decode, because we do not have the decode key
type EntityResponse ¶
type EntityResponse[T interface{}] struct {
Data T `json:"data"`
}
type ErrorResponse ¶
type ErrorResponse struct {
Errors []string `json:"errors"`
}
type ListResponse ¶
type ListResponse[T interface{}] struct { Data []T `json:"data"` Meta ListMeta `json:"meta"` }
type UserIdentityCache ¶
type UserIdentityCache struct { Identities map[string]CacheEntry sync.Mutex }
var UsersCache *UserIdentityCache
func (*UserIdentityCache) Delete ¶
func (c *UserIdentityCache) Delete(accountId string)
func (*UserIdentityCache) Get ¶
func (c *UserIdentityCache) Get(accountId string) (models.UserIdentity, bool)
func (*UserIdentityCache) Set ¶
func (c *UserIdentityCache) Set(accountId string, identity models.UserIdentity)
Click to show internal directories.
Click to hide internal directories.