前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >RoR: Ruby On Rails 的 Web Service 2 使用before_invocation进行验证调用权限

RoR: Ruby On Rails 的 Web Service 2 使用before_invocation进行验证调用权限

作者头像
用户3135539
发布2018-09-12 11:40:24
9120
发布2018-09-12 11:40:24
举报
文章被收录于专栏:

使用before_invocation进行验证调用权限

API

class BlogApi < ActionWebService::API::Base   api_method :hello_world,   :expects => [{"password" => :string},{"user" => :string}],   :returns => [:string] end

Controller

class BlogController < ApplicationController   wsdl_service_name 'Blog'   web_service_api BlogApi wsdl_namespace 'http://www.somewhere.com' #web service的名字空间   web_service_scaffold :invoke before_invocation :login #指定拦截的方法名称   def hello_world(pass,user) "hello #{user}"   end     protected  def login(methodname,args) #参数为被拦截函数名,被拦截函数参数数组     raise "Method #{methodname} Not authenticated" unless args[0] == 'srcret'   end end

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2007-05-14 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档