只是想确认
Nitrogen Authentication and Authorization
应用程序编程接口。API的描述如下:
wf:user() -> User or 'undefined'
Return the user value that was previously set by wf:user(User)
wf:user(User) -> ok
Set the user for the current session.
wf:clear_user() -> ok
Same as wf:user(undefined).
wf:role(Role) -> 'true' or 'false'
Check if the current user has a specified role.
wf:role(Role, IsInRole) -> ok
Set whether the current user is in a specified role.
wf:clear_roles() -> ok
Remove the user from all roles.
要使用此API,我首先要根据存储凭据的数据库验证用户登录名,然后将wf:user(user)设置为已成功验证的用户?然后我可以做像检查如果
undefined = wf:user()
要知道用户是否已通过身份验证以保护受限制的页面?同样,我会为用户设置角色等,然后我也可以对该角色执行验证?氮气不知怎么的把这些信息储存在一个会议的背景中?