Skip to content

Commit

Permalink
3. first, set up the keratin authn libraries for your server and client
Browse files Browse the repository at this point in the history
  • Loading branch information
cainlevy committed May 1, 2017
1 parent bf01894 commit aae06eb
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -4,3 +4,4 @@ gem 'puma'
gem 'sqlite3'
gem 'sinatra', require: 'sinatra'
gem 'sinatra-sequel'
gem 'keratin-authn'
26 changes: 26 additions & 0 deletions Gemfile.lock
@@ -1,10 +1,31 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (5.1.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
bindata (2.4.0)
concurrent-ruby (1.0.5)
i18n (0.8.1)
json-jwt (1.7.1)
activesupport
bindata
multi_json (>= 1.3)
securecompare
url_safe_base64
keratin-authn (0.4.1)
json-jwt
lru_redux
lru_redux (1.1.0)
minitest (5.10.1)
multi_json (1.12.1)
puma (3.7.0)
rack (1.6.5)
rack-protection (1.5.3)
rack
securecompare (1.0.0)
sequel (4.43.0)
sinatra (1.4.8)
rack (~> 1.5)
Expand All @@ -14,12 +35,17 @@ GEM
sequel (>= 3.2.0)
sinatra (>= 0.9.4)
sqlite3 (1.3.13)
thread_safe (0.3.6)
tilt (2.0.6)
tzinfo (1.2.3)
thread_safe (~> 0.1)
url_safe_base64 (0.2.2)

PLATFORMS
ruby

DEPENDENCIES
keratin-authn
puma
sinatra
sinatra-sequel
Expand Down
8 changes: 8 additions & 0 deletions app.rb
Expand Up @@ -9,6 +9,14 @@
end
end

Keratin::AuthN.config.tap do |config|
# The base URL of your Keratin AuthN service
config.issuer = "https://keratin-authn-demo.herokuapp.com"

# The domain of your application
config.audience = 'localhost'
end

class User < Sequel::Model
end

Expand Down
8 changes: 8 additions & 0 deletions views/layout.erb
Expand Up @@ -10,5 +10,13 @@
</nav>
<%= yield %>
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.0.5/es6-promise.auto.min.js"></script>
<script src="https://unpkg.com/keratin-authn@0.10.0/dist/keratin-authn.min.js"></script>
<script>
KeratinAuthN.setHost("<%= Keratin::AuthN.config.issuer %>");
KeratinAuthN.setCookieStore('authn');
KeratinAuthN.restoreSession().catch(console.log);
</script>
</body>
</html>

0 comments on commit aae06eb

Please sign in to comment.