utils

package
v0.0.0-...-a352208 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminSP

func AdminSP(next http.Handler) http.Handler

AdminSP delete SP_USER header and then repopulate with an empty value if unauthenticated, returns 401 or 403 if failure and does not proceed to handler.

func AuthM

func AuthM(next http.Handler) http.Handler

AuthM delete TRIBIST_USER header and then repopulate with an empty value if unauthenticated, returns 401 or 403 if failure and does not proceed to handler.

func AuthRefreshSP

func AuthRefreshSP(next http.Handler) http.Handler

AuthRefreshSP delete SP_USER header and then repopulate with an empty value if unauthenticated, returns 401 or 403 if failure and does not proceed to handler. This middleware expects a refresh token, It will return 403 for access token.

func AuthSP

func AuthSP(next http.Handler) http.Handler

AuthSP delete SP_USER header and then repopulate with an empty value if unauthenticated, returns 401 or 403 if failure and does not proceed to handler.

func CheckM

func CheckM(next http.Handler) http.Handler

CheckM will delete the TRIBIST_USER and will try and parse the TRIBIST_JWT header. If successful will set TRIBIST_USER. Even if authentication fails this middleware will call the handler.

func CheckSP

func CheckSP(next http.Handler) http.Handler

CheckSP will delete the SP_USER and will try and parse the SP_JWT header. If successful will set TRIBIST_USER. Even if authentication fails this middleware will call the handler.

func CreateSignedSPTokens

func CreateSignedSPTokens(phone, userID string) (string, string, error)

func CreateSignedToken

func CreateSignedToken(username, userID string) (string, error)

func ExtractTags

func ExtractTags(tweet string) ([]string, error)

func WriteData

func WriteData(rw http.ResponseWriter, status int, data interface{})

func WriteError

func WriteError(rw http.ResponseWriter, status int, errorStr string)

Types

type AWS

type AWS struct {
	Config aws.Config
}

func NewAWS

func NewAWS() (*AWS, error)

func (*AWS) CreateSignedGetUrl

func (awsMgr *AWS) CreateSignedGetUrl(bucket, name string,
	expiry time.Duration) (string, map[string]string, error)

func (*AWS) CreateSignedPutUrl

func (awsMgr *AWS) CreateSignedPutUrl(bucket, name string,
	expiry time.Duration) (string, map[string]string, error)

func (*AWS) GetSPBucketSize

func (awsMgr *AWS) GetSPBucketSize(bucket, userID string) (uint64, int, error)

type Claims

type Claims struct {
	Username string `json:"username"`
	UserID   string `json:"user_id"`
	jwt.RegisteredClaims
}

type FontDetails

type FontDetails struct {
	Name string
}

func ExtractFonts

func ExtractFonts(tweet string) ([]*FontDetails, error)

ExtractThreads The format is #font:<name of font>

type SPClaims

type SPClaims struct {
	Phone  string `json:"phone"`
	UserID string `json:"user_id"`
	jwt.RegisteredClaims
}

type ThreadDetails

type ThreadDetails struct {
	ID  string
	Seq int
}

func ExtractThreads

func ExtractThreads(tweet string) ([]*ThreadDetails, error)

ExtractThreads The format is #thread:<uuid of thread>:<0 indexed sequence number>

Jump to

Keyboard shortcuts

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