Documentation
¶
Index ¶
- Constants
- func CheckPassword(plain, hashed string) error
- func CreateKey(subject string) (string, error)
- func DecodeJwt(key string) (*jwt.StandardClaims, error)
- func InitLogger(l *zap.Logger)
- func InitMongoRepository(r *mongo.Repository)
- func SetSecretKey(key string)
- func StartHTTPServer(host string, port int, errChan chan error)
- type AuthError
- type Config
- type User
Constants ¶
const Issuer string = "mainflux"
Variables ¶
This section is empty.
Functions ¶
func CheckPassword ¶
CheckPassword tries to determine whether or not the submitted password matches the one stored (and hashed) during registration. An error will be used to indicate an invalid password.
func InitMongoRepository ¶
func InitMongoRepository(r *mongo.Repository)
InitMongoRepository - Init Mongo DB
func SetSecretKey ¶
func SetSecretKey(key string)
SetSecretKey sets the secret key that will be used for decoding and encoding tokens. If not invoked, a default key will be used instead.
func StartHTTPServer ¶
Types ¶
type AuthError ¶
AuthError is used as a wrapper for all types of errors originated throughout the service. Code will be used as API response status.
type User ¶
type User struct { ID string `json:"id"` Username string `json:"username"` Password string `json:"password"` }
func CreateUser ¶
CreateUser creates new user account based on provided username and password. The account is assigned with one master key - a key with all permissions on all owned resources regardless of their type. Provided password in encrypted using bcrypt algorithm.