Documentation ¶
Index ¶
- Constants
- func CheckPasswordHash(password, hash string) bool
- func GenerateJWTSecret() ([]byte, error)
- func GenerateJWTToken(uuid string, expiration int64) (string, error)
- func HashPassword(password string) string
- func IsValidUUID(u string) bool
- func LoadJWTSecret(secret []byte)
- func QueryBuilder(env *Env, r *http.Request) (storm.Query, error)
- func ValidateJWTToken(tokenString string) (*jwt.StandardClaims, error)
- type Env
- type QueryBuilderParams
Constants ¶
const ( StandardTokenExpiration = 15 // StandardTokenExpiration minutes ExtendedTokenExpiration = (24 * 30) * 60 //30 days in minutes SecretLength = 128 / 8 // 128 bits )
Token expiration durations
Variables ¶
This section is empty.
Functions ¶
func CheckPasswordHash ¶
CheckPasswordHash checks a plaintext password with a hashed password
func GenerateJWTSecret ¶
Generate and use a new secret. The returned secret should be stored by the caller and passed to the LoadJWTSecret on each startup.
func GenerateJWTToken ¶
GenerateJWTToken returns a JWT token based on the uuid, expiration and the secret sign
func HashPassword ¶
HashPassword hashes the given password with bcrypt
func IsValidUUID ¶
IsValidUUID is a function that returns true if the input is a valid uuid. And false if the input isn't a valid uuid https://stackoverflow.com/a/46315070
func LoadJWTSecret ¶
func LoadJWTSecret(secret []byte)
Use the given secret for generating and validating tokens
func QueryBuilder ¶
QueryBuilder is a method that generates storm query to give a more fine grain control over results Some query string examples that can be used filter example.com?format=[{key:value}] skip example.com?skip=10 limit example.com?limit=10 orderBy example.com?orderBy=Name,Age orderBy with reverse example.com?orderBy=Name,Age&reverse=true
func ValidateJWTToken ¶
func ValidateJWTToken(tokenString string) (*jwt.StandardClaims, error)
ValidateJWTToken Returns if the given token is a valid token
Types ¶
type QueryBuilderParams ¶
type QueryBuilderParams struct { //[{"key": "ID", "value": 1}] Array of values you want to filter Filter string `json:"filter"` // How many results it should skip Skip int `json:"skip"` // Max results returned Limit int `json:"limit"` // "Name, Age" Order by OrderBy []string `json:"orderBy"` // Reverse Order by Reverse bool `json:"reverse"` }
swagger:parameters GetAllLogFiles GetAllCharts GetAllSheets GetAllWorkspaces