Skip to content

abchlli/hero

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hero

Secure, performant and effortless authentication.

Big WIP.
How will it look like?

func main() {
	// Create a configuration.
	config := hero.Config{
		MasterKey:        "secret",
		Mailer:           "smtp://user:secret@localhost:1025",
		DatabaseDriver:   "sqlite",
		DatabaseLocation: "test.db",
	}
	// Initialize it.
	auth, err := hero.Init(config)
	if err != nil {
		fmt.Println("failed to initialize hero: ", err)
	}
	// Create a router.
	router := chi.NewRouter()
	// Mount the route group.
	router.Mount("/auth", auth)
	// Protect your routes!
	router.Group(func(r chi.Router) {
		r.Use(hero.Protect)
		r.Get("/data", handleGetData)
		r.Post("/data", handlePostData)
	})
	// router.Get("/public")
	// ...
	// Serving.
	http.ListenAndServe(":8080", router)
}

About

Future-proof authentication.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages