ToolipsAuth
is now a part of ToolipsSession
in Toolips
0.3
. ToolipsSession.
- ( This project can still be used with
Toolips
0.2
. )
Authentication has long been a daunting and problematic task for many developers, but this is no more with toolips. Using this extension, we can create different experiences for different groups just by writing different functions!
- step 1: add toolips auth to your webapp:
using Toolips
using Pkg
Toolips.new_webapp("MyApp")
Pkg.add("ToolipsAuth")
- step 2: add toolips auth to your extension vector:
routes = [route("/", home), fourofour]
extensions = Vector{ServerExtension}([Logger(), Files(), Session(), Auth()])
- step 3: use toolips auth. The
group
method is passed a Connection, String, and Function to produce the high-level syntax. clients are grouped as 'new' by default.
function home(c::Connection)
group(c, "user") do c::Connection
write!(c, "this is the user page")
end
group(c, "new") do c::Connection
group!(c, "user", reset = true)
write!(c, "you are now a user!, click below to reload!")
b = button("reload", text = "reload")
on(c, b, "click") do cm::ComponentModifier
redirect!(cm, "/")
end
write!(c, [br(), b])
end
end