keratin-authn 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -7
- data/lib/keratin/authn.rb +9 -5
- data/lib/keratin/authn/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1336382812f7128c3798e4755704ed4ae5e7c0c
|
4
|
+
data.tar.gz: 129628c64978b64624b8b13d8bc25dbae57157eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f4274f0ccdaa9feaa97746468fb41e3f6dcae8c1d84bc6ce89517ef6d4e326835305f33939a42f362549c02ef7f6dae96985dbc27ee041855e421703fae5130
|
7
|
+
data.tar.gz: e0c25194d2ee5909c451c5dc1b712e42352b8d89292ef1345529dd4a4f7998e3a040166f31be3921b989abf0fb0b821d05bcbb1c6bef0b9be3ec5d6af79c4d89
|
data/README.md
CHANGED
@@ -5,7 +5,10 @@ Keratin AuthN is an authentication service that keeps you in control of the expe
|
|
5
5
|
This gem provides utilities to help integrate with the backend of a Ruby application. You will also
|
6
6
|
need a client for your frontend, such as [keratin/authn-js](https://github.com/keratin/authn-js).
|
7
7
|
|
8
|
-
[](https://gitter.im/keratin/authn-server?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
9
|
+
[](http://badge.fury.io/rb/keratin-authn)
|
10
|
+
[](https://travis-ci.org/keratin/authn-rb)
|
11
|
+
[](https://coveralls.io/github/keratin/authn?branch=master)
|
9
12
|
|
10
13
|
## Installation
|
11
14
|
|
@@ -50,12 +53,6 @@ end
|
|
50
53
|
Use `Keratin::AuthN.subject_from(params[:authn])` to fetch an `account_id` from the session if and
|
51
54
|
only if the session is valid.
|
52
55
|
|
53
|
-
### Logging Out
|
54
|
-
|
55
|
-
Send users to `Keratin::AuthN.logout_url(return_to: some_path)` to log them out from the AuthN
|
56
|
-
server. If you use [keratin/authn-js](https://github.com/keratin/authn-js), you might prefer the
|
57
|
-
logout functionality there as it can also take care of deleting the cookie.
|
58
|
-
|
59
56
|
### Modifying Accounts
|
60
57
|
|
61
58
|
* `Keratin.authn.update(account_id, username: 'new@example.tech')`: will synchronize an email change
|
data/lib/keratin/authn.rb
CHANGED
@@ -9,9 +9,10 @@ require 'lru_redux'
|
|
9
9
|
require 'json/jwt'
|
10
10
|
|
11
11
|
module Keratin
|
12
|
+
# Client for AuthN API calls
|
12
13
|
def self.authn
|
13
14
|
@authn ||= AuthN::API.new(
|
14
|
-
AuthN.config.authn_url
|
15
|
+
AuthN.config.authn_url,
|
15
16
|
username: AuthN.config.username,
|
16
17
|
password: AuthN.config.password
|
17
18
|
)
|
@@ -30,7 +31,10 @@ module Keratin
|
|
30
31
|
# the base url for API calls. this is useful if you've divided your network so private API
|
31
32
|
# requests can not be probed by public devices. it is optional, and will default to issuer.
|
32
33
|
# e.g. "https://authn.internal.dns"
|
33
|
-
|
34
|
+
attr_writer :authn_url
|
35
|
+
def authn_url
|
36
|
+
@authn_url || issuer
|
37
|
+
end
|
34
38
|
|
35
39
|
# how long (in seconds) to keep keys in the keychain before refreshing.
|
36
40
|
# default: 3600
|
@@ -56,10 +60,10 @@ module Keratin
|
|
56
60
|
config.logger.debug{ yield } if config.logger
|
57
61
|
end
|
58
62
|
|
59
|
-
# The default keychain will fetch JWKs from
|
60
|
-
#
|
63
|
+
# The default keychain will fetch JWKs from AuthN and return the correct key by id. Keys are
|
64
|
+
# cached in memory to reduce network traffic.
|
61
65
|
def self.keychain
|
62
|
-
@keychain ||= FetchingKeychain.new(issuer: config.
|
66
|
+
@keychain ||= FetchingKeychain.new(issuer: config.authn_url, ttl: config.keychain_ttl)
|
63
67
|
end
|
64
68
|
|
65
69
|
# If the default keychain is not desired (as in host application tests), different keychain may
|
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.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lance Ivy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json-jwt
|