-
-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathserver.rb
More file actions
executable file
·44 lines (34 loc) · 797 Bytes
/
server.rb
File metadata and controls
executable file
·44 lines (34 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env ruby
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gemspec path: "../"
gem "sinatra"
gem "rackup"
gem "puma"
gem "json", require: false
gem "nap", require: "rest"
end
require "json"
require "securerandom"
require "sinatra"
require "omniauth-openid"
require "openid/store/filesystem"
use Rack::Session::Cookie, secret: SecureRandom.hex(64)
use OmniAuth::Builder do
provider :open_id, store: OpenID::Store::Filesystem.new("/tmp")
end
get "/" do
<<-HTML
<ul>
<li><a href='/auth/open_id'>Sign in with OpenID</a></li>
</ul>
HTML
end
[:get, :post].each do |method|
send method, "/auth/:provider/callback" do
content_type "text/plain"
request.env["omniauth.auth"].info.to_hash.inspect
end
end
Sinatra::Application.run!