1
나는 루비 openId 예제를 sinatra에서 우분투 이미지로 실행하고 있습니다. ruby sinatra openid 앱이 "Nonce가 이미 사용되었거나 범위를 벗어났습니다."
%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>
내가, 구글 내 자격 증명을 입력 redircted 대신 내가 할 액세스 권한이 부여되는하고있는 구글의 URL (https://www.google.com/accounts/o8/id) 를 입력 할 때 :
난스 이미 사용 또는 범위의 아웃 : "2012-05-09T13 : 50 : xxxxxxxxxxxxxxx입니다"
(BTW, 내가 사용 루비 프로그램을 실행하고 있지 "샷건"을 "루비"). 누군가 출력물의 의미와 해결 방법에 대해 통찰력을 줄 수 있습니까? 감사합니다.