Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ruby sinatra openid应用程序回复为;当前已使用或超出范围”;_Ruby_Openid_Sinatra_Google Openid_Nonce - Fatal编程技术网

ruby sinatra openid应用程序回复为;当前已使用或超出范围”;

ruby sinatra openid应用程序回复为;当前已使用或超出范围”;,ruby,openid,sinatra,google-openid,nonce,Ruby,Openid,Sinatra,Google Openid,Nonce,我正在Ubuntu映像上运行sinatra上的以下ruby openId示例 %w(rubygems sinatra openid openid/store/filesystem).each { |lib| require lib} REALM = 'http://localhost:4567' RETURN_TO = "#{REALM}/complete" get '/loginform' do erb :loginform end post '/login' do c

我正在Ubuntu映像上运行sinatra上的以下ruby openId示例

    %w(rubygems sinatra openid openid/store/filesystem).each { |lib| require lib}

REALM = 'http://localhost:4567'
RETURN_TO = "#{REALM}/complete"

get '/loginform' do
  erb :loginform
end


post '/login' do
  checkid_request = openid_consumer.begin(params[:openid_identifier])
  redirect checkid_request.redirect_url(REALM, RETURN_TO) if checkid_request.send_redirect?(REALM, RETURN_TO)
  checkid_request.html_markup(REALM, RETURN_TO)
end

get '/complete' do
  response = openid_consumer.complete(params, RETURN_TO)
  return 'You are logged in!' if response.status == OpenID::Consumer::SUCCESS
   msg=response.message
   <<-eos
    Could not log on with your OpenID due to #{msg}
    eos
end

def openid_consumer
  @consumer = OpenID::Consumer.new(session, OpenID::Store::Filesystem.new("#{File.dirname(__FILE__)}/.tmp/openid")) if @consumer.nil?
  return @consumer
end


enable :inline_templates

__END__

@@ layout
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  <title>got openid?</title>
</head>
<body>
  <%= yield %>
</body>
</html>


@@ loginform
<form method="post" accept-charset="UTF-8" action='/login'>
  Identifier:
  <input type="text" class="openid" name="openid_identifier" />
  <input type="submit" value="Verify" />
</form>
%w(rubygems sinatra openid openid/store/filesystem)
王国http://localhost:4567'
返回到=“#{REALM}/complete”
获取“/loginform”do
雇员再培训局:loginform
结束
post'/login'do
checkid\u request=openid\u consumer.begin(参数[:openid\u标识符])
重定向checkid请求。如果checkid请求,则重定向url(领域,返回到)。发送重定向?(领域,返回到)
checkid\u request.html\u标记(领域,返回到)
结束
获取“/完成”do
response=openid\u consumer.complete(参数,返回到)
return“您已登录!”如果response.status==OpenID::Consumer::SUCCESS
msg=response.message
解决了!
这个问题源于商店的私事。
我认为这主要是Ubuntu的问题

我改变了这一点:

@consumer = OpenID::Consumer.new(session, OpenID::Store::Filesystem.new("#{File.dirname(__FILE__)}/.tmp/openid")) if @consumer.nil?
进入此(无状态):

成功了

解决了! 这个问题源于商店的私事。 我认为这主要是Ubuntu的问题

我改变了这一点:

@consumer = OpenID::Consumer.new(session, OpenID::Store::Filesystem.new("#{File.dirname(__FILE__)}/.tmp/openid")) if @consumer.nil?
进入此(无状态):

成功了