keratin-authn 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 675c925f05dfabe4bd0f21df787374d84656bb54
4
- data.tar.gz: 6707f4d2b665485192152bf7a59c5a1d62800e7d
3
+ metadata.gz: 6da81c6e1e1cfff24bdf967c5c639bf965a6bd36
4
+ data.tar.gz: 16b387f8a34beb746cd96c5bcecbc6a0e2df3578
5
5
  SHA512:
6
- metadata.gz: 9c539082ff017a26237d848342769115ca0ad978ec470505e516fcb91879499fc7bb27d0f43601a434b480e70acfbb55ec2c124686e6b8bc3319e2d38a197d13
7
- data.tar.gz: d41c0567fd3f85b164c82a8c0bb5237d4f0e0e9865fb3a0bfe6d2a5e6996381b55cb1c3658713be50525cdafce31480e34d1d73a4d0523a1530104f207ad8129
6
+ metadata.gz: 04788a20f670dd537bc463b1d818b7b39626c6745750f3ea3e70b481b8f04f1b3e6215c064165face2508e0d40a967c5ed98507807cb05cff98d20e9d5781f58
7
+ data.tar.gz: b7c68b8969f1bbbc3f4b00df843245c66ef4620a42c748082bb5a6c8edcd8ff18094dc942bd78a3f5a308f24887c0d91b508f8d1127ee39d87e6c2381be7db92
data/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  Keratin AuthN is an authentication service that keeps you in control of the experience without forcing you to be an expert in web security.
4
4
 
5
- This gem provides utilities to help integrate with a Ruby application. You may also be interested in keratin/authn-js for frontend integration.
5
+ This gem provides utilities to help integrate with the backend of a Ruby application. You will also
6
+ need a client for your frontend, such as [keratin/authn-js](https://github.com/keratin/authn-js).
6
7
 
7
8
  [![Gem Version](https://badge.fury.io/rb/keratin-authn.svg)](http://badge.fury.io/rb/keratin-authn) [![Build Status](https://travis-ci.org/keratin/authn-rb.svg?branch=master)](https://travis-ci.org/keratin/authn-rb) [![Coverage Status](https://coveralls.io/repos/github/keratin/authn/badge.svg?branch=master)](https://coveralls.io/github/keratin/authn?branch=master)
8
9
 
@@ -20,21 +21,27 @@ Configure your integration from a file such as `config/initializers/keratin.rb`:
20
21
 
21
22
  ```ruby
22
23
  Keratin::AuthN.config.tap do |config|
23
- # The base URL of your Keratin AuthN service
24
+ # The AUTHN_URL of your Keratin AuthN server. This will be used to verify tokens created by AuthN,
25
+ # and will also be used for API calls unless `config.authn_url` is also set (see below).
24
26
  config.issuer = 'https://authn.myapp.com'
25
27
 
26
- # The domain of your application (no protocol)
28
+ # The domain of your application (no protocol). This domain should be listed in the APP_DOMAINS of
29
+ # your Keratin AuthN server.
27
30
  config.audience = 'myapp.com'
28
31
 
29
- # HTTP basic auth for using AuthN's private endpoints
32
+ # Credentials for AuthN's private endpoints. These will be used to execute admin actions using the
33
+ # `Keratin.authn` client provided by this library.
34
+ #
35
+ # TIP: make them extra secure in production!
30
36
  config.username = 'secret'
31
37
  config.password = 'secret'
32
38
 
33
39
  # OPTIONAL: enables debugging for the JWT verification process
34
- config.logger = Rails.logger
40
+ # config.logger = Rails.logger
35
41
 
36
- # OPTIONAL: allows private API calls to use private network routing
37
- config.authn_url = 'https://authn.internal.dns/
42
+ # OPTIONAL: Send private API calls to AuthN using private network routing. This can be necessary
43
+ # if your environment has a firewall to limit public endpoints.
44
+ # config.authn_url = 'https://authn.internal.dns/
38
45
  end
39
46
  ```
40
47
 
@@ -144,8 +151,8 @@ In your `test/test_helper.rb` or equivalent:
144
151
 
145
152
  ```ruby
146
153
  # Configuring AuthN to use the MockKeychain will stop your tests from attempting to connect to the
147
- # remote issuer during tests.
148
- Keratin::AuthN.signature_verifier = Keratin::AuthN::MockKeychain.new
154
+ # remote issuer during tests. The MockKeychain creates a single weak key, for speedy tests.
155
+ Keratin::AuthN.keychain = Keratin::AuthN::MockKeychain.new
149
156
 
150
157
  # Including the Test::Helpers module grants access to `id_token_for(user.account_id)`, so that you
151
158
  # can test your system with real tokens.
@@ -1,7 +1,18 @@
1
1
  module Keratin::AuthN
2
2
  class MockKeychain
3
- def [](kid)
4
- true
3
+ # a temporary RSA key for the test suite.
4
+ #
5
+ # generates the smallest (fastest) key possible for RS256
6
+ def initialize
7
+ @keypair ||= OpenSSL::PKey::RSA.new(512).to_jwk
8
+ end
9
+
10
+ def key
11
+ @keypair
12
+ end
13
+
14
+ def [](_)
15
+ key
5
16
  end
6
17
  end
7
18
  end
@@ -10,14 +10,7 @@ module Keratin::AuthN::Test
10
10
  sub: subject,
11
11
  iat: 10.seconds.ago,
12
12
  exp: 1.hour.from_now
13
- ).sign(jws_keypair.to_jwk, JWS_ALGORITHM).to_s
14
- end
15
-
16
- # a temporary RSA key for the test suite.
17
- #
18
- # generates the smallest (fastest) key possible for RS256
19
- private def jws_keypair
20
- @keypair ||= OpenSSL::PKey::RSA.new(512)
13
+ ).sign(Keratin::AuthN.keychain.key, JWS_ALGORITHM).to_s
21
14
  end
22
15
  end
23
16
  end
@@ -1,5 +1,5 @@
1
1
  module Keratin # rubocop:disable Style/ClassAndModuleChildren
2
2
  module AuthN
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keratin-authn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lance Ivy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-02 00:00:00.000000000 Z
11
+ date: 2017-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json-jwt