Documentation
¶
Index ¶
- Constants
- Variables
- func Bind(c *gin.Context, obj interface{}) error
- func CompareData(c *gin.Context, authD *AccessDetails) (string, error)
- func ExtractToken(r *http.Request) string
- func GenToken(id primitive.ObjectID) string
- func GetCollection(dbname string, collection string) *mongo.Collection
- func GetMongoDB() *mongo.Client
- func GetRedis() *redis.Client
- func InitMongo(mongoURI string) error
- func InitRedis() error
- func RandString(n int) string
- func ValidateToken(r *http.Request) error
- func VerifyToken(r *http.Request) (*jwt.Token, error)
- type AccessDetails
- type TokenDetails
Constants ¶
View Source
const NBRandomPassword = "A String Very Very Very Niubilty!!@##$!@#4"
NBRandomPassword : random password
View Source
const NBSecretPassword = "A String Very Very Very Strong!!@##$!@#$"
NBSecretPassword : secret password
Variables ¶
View Source
var MoDB *mongo.Client
MoDB : reference to mongodb client
View Source
var RedisClient *redis.Client
RedisClient ...
Functions ¶
func CompareData ¶
func CompareData(c *gin.Context, authD *AccessDetails) (string, error)
CompareData : compare extracted token data with data stored in redis
func GetCollection ¶
func GetCollection(dbname string, collection string) *mongo.Collection
GetCollection : get collection
Types ¶
type AccessDetails ¶
AccessDetails ...
func ExtractTokenMetadata ¶
func ExtractTokenMetadata(r *http.Request) (*AccessDetails, error)
ExtractTokenMetadata ...
type TokenDetails ¶
type TokenDetails struct { AccessToken string RefreshToken string AccessUUID string RefreshUUID string AtExpires int64 RtExpires int64 }
TokenDetails ...
func CreateToken ¶
func CreateToken(userid primitive.ObjectID) (*TokenDetails, error)
CreateToken ...
Click to show internal directories.
Click to hide internal directories.