Sinatraã£ã¦ãããRackã®ããã«ã¦ã§ã¢ã§ããã¾ããã sudo gem install rack_csrf# app.rb require 'rubygems' require 'sinatra' require 'rack/csrf' get '/' do @msg = 'Hello World' erb :index end post '/' do @msg = 'Hello CSRF' erb :index end configure do set :app_file, __FILE__ use Rack::Session::Cookie, :secret => 'change me' use Rack::Csrf, :raise => true end helpers do def csrf_token Rack::Csrf.csrf_token(env) end def
{{#tags}}- {{label}}
{{/tags}}