authrocket 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/authrocket/api/version.rb +1 -1
- data/lib/authrocket/auth_provider.rb +42 -1
- data/lib/authrocket/credential.rb +4 -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: 7c054a38d59b78ebb06c889ca6aac2b4c6b50805
|
4
|
+
data.tar.gz: fdd903042c19e81a680f59c53046b1f6a161ed59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5202950282c56717b58192d753844fd3240cbf61b5ece558f8922325c810dabbc38bdc7642941a8bb91473fc97f1f7ad8c71258c0804de05529eed708a4dbaf7
|
7
|
+
data.tar.gz: b0e99ca0dabf5c8a0b8acb468c1b199623376df9768b2f755e35ce06fa0d734795440ff00fc70aac334989e76ef2f92a636f91a54bc97d9afccce487a4c3a638
|
data/CHANGELOG.md
CHANGED
@@ -4,8 +4,49 @@ module AuthRocket
|
|
4
4
|
|
5
5
|
belongs_to :realm
|
6
6
|
|
7
|
-
attr :provider_type
|
7
|
+
attr :provider_type, :state
|
8
8
|
attr :login, :name_field, :signup
|
9
|
+
attr :client_id, :client_secret, :scopes
|
10
|
+
|
11
|
+
|
12
|
+
# attribs - :redirect_uri - required
|
13
|
+
# - :nonce - optional
|
14
|
+
def self.authorize_urls(attribs={}, api_creds=nil)
|
15
|
+
parsed, creds = request(:get, url+'/authorize', api_creds, attribs)
|
16
|
+
if parsed[:errors].any?
|
17
|
+
raise Error, parsed[:errors].inspect
|
18
|
+
end
|
19
|
+
NCore::Collection.new.tap do |coll|
|
20
|
+
coll.metadata = parsed[:metadata]
|
21
|
+
parsed[:data].each do |hash|
|
22
|
+
coll << GenericObject.new(hash.merge(metadata: parsed[:metadata]), creds)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# attribs - :redirect_uri - required
|
28
|
+
# - :nonce - optional
|
29
|
+
def self.authorize_url(auth_provider_id, attribs={}, api_creds=nil)
|
30
|
+
parsed, creds = request(:get, url+"/#{auth_provider_id}/authorize", api_creds, attribs)
|
31
|
+
if parsed[:errors].any?
|
32
|
+
raise Error, parsed[:errors].inspect
|
33
|
+
end
|
34
|
+
parsed[:data][:url]
|
35
|
+
end
|
36
|
+
|
37
|
+
# same as self.authorize_url(self.id, ...)
|
38
|
+
def authorize_url(attribs={})
|
39
|
+
self.class.authorize_url(id, attribs, api_creds)
|
40
|
+
end
|
41
|
+
|
42
|
+
# attribs - :code - required
|
43
|
+
# - :nonce - optional
|
44
|
+
# - :state - required
|
45
|
+
# always returns a new object; check .errors? or .valid? to see how it went
|
46
|
+
def self.authorize(attribs={}, api_creds=nil)
|
47
|
+
parsed, creds = request(:post, url+'/authorize', api_creds, attribs)
|
48
|
+
User.new(parsed, creds)
|
49
|
+
end
|
9
50
|
|
10
51
|
end
|
11
52
|
end
|
@@ -2,10 +2,13 @@ module AuthRocket
|
|
2
2
|
class Credential < Resource
|
3
3
|
crud :find, :create, :update, :delete
|
4
4
|
|
5
|
+
belongs_to :auth_provider
|
5
6
|
belongs_to :user
|
6
7
|
|
7
|
-
attr :
|
8
|
+
attr :credential_type
|
9
|
+
attr :api_key
|
8
10
|
attr :password, :password_confirmation
|
11
|
+
attr :access_token, :provider_user_id, :token_expires_at
|
9
12
|
|
10
13
|
end
|
11
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authrocket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thomas morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ncore
|