首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

play secure模块 印证和授权管理

2012-07-24 
play secure模块 验证和授权管理参考:http://www.playframework.org/documentation/1.2.3/securePlay Secu

play secure模块 验证和授权管理
参考:http://www.playframework.org/documentation/1.2.3/secure

Play Secure模块放置在play安装目录\modules\secure下,包含在play标准的发布包中。简单的Secure模块被设计用来帮助用户在应用程序中提供验证和授权管理。它提供了一个简单的控制器controllers.Secure,在里面定义了一些拦截器,你能很容易地使用@With注解把这些拦截器加到自己的控制器中。

启用Secure模块:
在/conf/dependencies.yml文件中增加如下内容:

package controllers; public class Security extends Secure.Security {    …        static boolean check(String profile) {        User user = User.find("byEmail", connected()).first();        if ("isAdmin".equals(profile)) {            return user.admin;        }        else {            return false;        }    }    }

热点排行