keratin-authn 0.3.2 → 0.4.0
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/.gitignore +1 -0
- data/README.md +10 -1
- data/keratin-authn.gemspec +1 -0
- data/lib/keratin/authn/issuer.rb +13 -0
- data/lib/keratin/authn/version.rb +1 -1
- data/lib/keratin/client.rb +6 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41e0f6b3be694546e1b0d6d6c0fc7edc59c31b92
|
4
|
+
data.tar.gz: ea05eb73430755ffe1c1206d3a05f4450b760a9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ce29627b9490406232318c6c7aa1c8ba5487cb25fe3a156a96829668f3d4daf38050b28a7c7d9e56c5235dd2e3d0f0fa7c0b888b88d0ead76e2bd9fb402c221
|
7
|
+
data.tar.gz: d1dc214b9a05d61814238ac04763da77d1ac88679da02866d3ca7851c30098ae6eb5fbd92a9f4b48a14076dee86d2f887c648dde9439655793b0c3e9c78dad8f
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@ Keratin AuthN is an authentication service that keeps you in control of the expe
|
|
4
4
|
|
5
5
|
This gem provides utilities to help integrate with a Ruby application. You may also be interested in keratin/authn-js for frontend integration.
|
6
6
|
|
7
|
-
[](http://badge.fury.io/rb/keratin-authn) [](https://travis-ci.org/keratin/authn-rb)
|
7
|
+
[](http://badge.fury.io/rb/keratin-authn) [](https://travis-ci.org/keratin/authn-rb) [](https://coveralls.io/github/keratin/authn?branch=master)
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -50,6 +50,15 @@ logout functionality there as it can also take care of deleting the cookie.
|
|
50
50
|
* `Keratin.authn.unlock(account_id)`: will unlock an account, restoring normal functionality.
|
51
51
|
* `Keratin.authn.archive(account_id)`: will wipe all personal information, including username and
|
52
52
|
password. Intended for user deletion routine.
|
53
|
+
* `Keratin.authn.expire_password(account_id)`: will force the account to reset their password on the
|
54
|
+
next login, and revoke all current sessions. Intended for use when password is deemed insecure or
|
55
|
+
otherwise expired.
|
56
|
+
|
57
|
+
### Other
|
58
|
+
|
59
|
+
* `Keratin.authn.import(username: user.email, password: user.password, locked: false)`: will create
|
60
|
+
an account in Keratin. Intended for importing data from a legacy system. Returns an `account_id`,
|
61
|
+
or raises on validation errors.
|
53
62
|
|
54
63
|
### Example: Sessions
|
55
64
|
|
data/keratin-authn.gemspec
CHANGED
data/lib/keratin/authn/issuer.rb
CHANGED
@@ -15,6 +15,19 @@ module Keratin::AuthN
|
|
15
15
|
delete(path: "/accounts/#{account_id}").result
|
16
16
|
end
|
17
17
|
|
18
|
+
# returns account_id or raises exception
|
19
|
+
def import(username:, password:, locked: false)
|
20
|
+
post(path: '/accounts/import', body: {
|
21
|
+
username: username,
|
22
|
+
password: password,
|
23
|
+
locked: locked
|
24
|
+
}).result['id']
|
25
|
+
end
|
26
|
+
|
27
|
+
def expire_password(account_id)
|
28
|
+
patch(path: "/accounts/#{account_id}/expire_password")
|
29
|
+
end
|
30
|
+
|
18
31
|
def signing_key(kid)
|
19
32
|
keys.find{|k| k['use'] == 'sig' && (kid.blank? || kid == k['kid']) }
|
20
33
|
end
|
data/lib/keratin/client.rb
CHANGED
@@ -39,6 +39,10 @@ module Keratin
|
|
39
39
|
submit(Net::HTTP::Get, **opts)
|
40
40
|
end
|
41
41
|
|
42
|
+
private def post(**opts)
|
43
|
+
submit(Net::HTTP::Post, **opts)
|
44
|
+
end
|
45
|
+
|
42
46
|
private def patch(**opts)
|
43
47
|
submit(Net::HTTP::Patch, **opts)
|
44
48
|
end
|
@@ -47,11 +51,12 @@ module Keratin
|
|
47
51
|
submit(Net::HTTP::Delete, **opts)
|
48
52
|
end
|
49
53
|
|
50
|
-
private def submit(request_klass, path:)
|
54
|
+
private def submit(request_klass, path:, body: nil)
|
51
55
|
uri = URI.parse("#{base}#{path}")
|
52
56
|
|
53
57
|
request = request_klass.new(uri)
|
54
58
|
request.basic_auth(*@auth) if @auth
|
59
|
+
request.set_form_data(body) if body
|
55
60
|
|
56
61
|
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
57
62
|
http.open_timeout = 0.5
|
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: 0.
|
4
|
+
version: 0.4.0
|
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-03-
|
11
|
+
date: 2017-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json-jwt
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: coveralls
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
description:
|
126
140
|
email:
|
127
141
|
- lance@cainlevy.net
|