- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我很难找到有关如何使用 authlogic 启用单一访问 token 身份验证的简单教程。有一些文档,但不是很有用。
我将 single_access_token 添加到我的数据库,我添加了这个:
single_access_allowed_request_types :any
到我的 session 类。但我仍然不明白如何使用每次调用传递的凭据参数对用户进行身份验证。我的 require_authentication before filter 像这样对 current_user 进行标准检查:
def current_session
return @current_session if @current_session
@current_session = Session.find
end
def current_user
@current_user = current_session && current_session.record
end
但这足以工作吗? Session.find 方法是根据我的参数神奇地记录用户,还是我必须创建单独的方法来实际检查 user_credentials 参数是否存在,然后根据它找到用户,然后让该用户登录。我很困惑,如果我每次使用 SAT 时真的在“创建”一个新 session ,或者我是否只是在每次进行 API 调用时将当前用户设置在前置过滤器中。
任何帮助都会很棒!谢谢!
最佳答案
我使用 authlogic 实现了一个 single_access_token 解决方案,我必须做的是将 single_access_allowed_request_types :all
添加到 UserSession 模型。
然后我将以下内容添加到我想要允许 single_access_token 身份验证的 Controller 中。
def single_access_allowed?
["some_action_1","some_action_2","some_action_3"].include?(action_name)
end
您似乎缺少 Controller 代码。因此,如果您有两个操作“get_user_info”和“update_user_info”,您将添加。
def single_access_allowed?
["get_user_info","update_user_info"].include?(action_name)
end
关于ruby-on-rails - Authlogic 和单一访问 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7906197/
我想在单个 View 中显示文本、图像。也请帮助我 我想从我的类(class)而不是 xml 提供图像的 src 请帮助谢谢 最佳答案 你可以为此使用Button Button b=new Butto
我有一个消息模型,管理员和用户都可以创建消息。但对于管理员和用户来说,有单独的模型,称为管理员和用户。 消息模型有一个名为“created_by”的列,用于存储创建者的 ID。现在的问题是我如何与 M
我无法为菜单资源充气,并且无法将其附加到我的 Activity 的工具栏上。 这似乎很简单,但是我想我缺少明显的东西。我正在使用NavGraph,所以我不知道这是否影响工具栏? 有人看到我做错了吗?
我正在开发一个应用程序,它有一个 MainActivity 并且有许多用于医院、诊所的 ImageViews ... 当按下其中一个时,它会带你到一个新的 Activity DisplayActivi
我会尽量保持简短,但我需要一些建议。 我所在的团队正在并行开发适用于 android、iphone 和 wp7 的应用程序。我们有一个设计团队,可以为所有三个平台提出一个单一的设计。 最新应用程序的设
我正在使用 Josh Smith 中的示例.他有一个显示 CustomerViewModel 列表的 WorkspaceViewModel。他使用相同的 ViewModel 来显示所有客户和编辑一个客
我是 Azure 新手,正在尝试了解各种服务,目前我正在尝试了解移动服务及其各种功能,例如身份验证和推送。 移动服务是否仅支持一种操作系统上的一个应用程序,还是可以在多个操作系统(Android、iO
我在 Stoyan Stefanov 的书中读到了关于单一变量模式的内容。 JSLint 也很好。 但我在我的代码中注意到我可能会重载此模式。整个我的 .js 文件,整个脚本只是一个大变量。 例如:
我想在一个 View 中添加多个具有不同不透明度的阴影。阴影的规范如下: Y 偏移量为 4,模糊半径为 1 Y 偏移量为 10,模糊半径为 10 Y 偏移量为 2,模糊半径为 4 1 的模糊半径,1
我们有几个 API,我们希望通过客户端凭据流授予对客户端的访问权限。流程会像这样。 客户端根据某个范围从 is4 获取 token 客户端使用 token 访问第一个 API 客户端需要使用相同的 t
我是 ruby on rails 的新手。我正在尝试在 ruby on rails 上设计一个注册表单,该表单具有 Basic 和 Paid 用户的单选按钮。当用户点击付费并点击提交时,应该会
我用 Entity Framework 6 开发了一个项目,该项目使用 MySQL 作为数据库。在我的 Windows 系统上,该项目正在运行。现在我试图在我的 linux 机器上移动那个项目。为了运
我正在为我的电子商务应用程序创 build 计。它将拥有由 AWS Lambda 支持的多项服务。 Orderservice、InventoryService、PaymentService、Loggi
我目前正在开发一个执行以下操作的单 View 应用程序: 使用 CoreLocation 获取用户位置 将他们的经/纬度发送到 API 以 JSON 格式返回潮汐数据 深入研究 JSON 中的对象和键
我想托管各种 Angular2 应用程序,这些应用程序使用相同的框架包和来自根域和子域的 node_modules: domain.com subdomain.domain.com sub2.doma
我正在尝试使用 Git Publisher 插件来标记带有 $BUILD_TAG 的成功构建,但我无法找出它将接受的 Target remote name 的值。如果我在 GIT 配置中使用 Repo
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 8年前关闭。 Improve thi
有一个带有许多控件的 View (窗口),以简化: 此 View 用于显示和编辑多个配置: public class ViewModel: INotifyPropertyChanged
我有一个 textView 和类似的文本 “这是带有 KeyWord 和 Link 浏览的简单文本” 在上面的文字中我想制作.. 点击链接可打开该网址和点击该关键字在我的应用程序中打开一个新 Acti
我在我现有的应用程序中有一个任务,我们有 2 个不同的数据库,一个在 SQL Server 中,另一个在 Oracle 中,但是两个模式是相同的。 目前我们有一个使用 Entity Framework
我是一名优秀的程序员,十分优秀!