virtuatable-core 1.6.0.dev3 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/core/services/authorizations.rb +20 -0
- data/lib/core/services/sessions.rb +1 -1
- data/lib/core/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b330926b15e557e0b16d5858262fafd042d46f1cd4938fad4c012795bc1f6fc9
|
4
|
+
data.tar.gz: f07af3efd591fd82840e623ab0f414459d25a109cc04a24341409ee16d06cf94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf83681ed7f261af971a5f60671a14ab1e16173e7b754ee6ffe9fc8ae3eda64d7a28ea2cd09529fded0e71f7bfc2cd415b961cc65b222a2ed2d7b90b1b6f386d
|
7
|
+
data.tar.gz: 8f0e5d901df834b6f48a34e9371ba2d473afbf1790eca64727de70e2b9e3750aaf3a15ae2052c2babecc176cda463b972aa0e9b28e59a908f5dee7aab0ff5a01
|
@@ -8,6 +8,26 @@ module Core
|
|
8
8
|
class Authorizations < Core::Services::Base
|
9
9
|
include Singleton
|
10
10
|
|
11
|
+
# Creates an authorization to access to the data of the user for the application. The user is
|
12
|
+
# identified by the UUID of its current connection session.
|
13
|
+
# [WARNING] this method should NOT be used outside of the authentication backend.
|
14
|
+
#
|
15
|
+
# @param session_id [String] the unique identifier of the current session of the user.
|
16
|
+
# @param client_id [String] the unique public identifier of the application.
|
17
|
+
# @return [Code::Decorators::Authorization] the created authorization
|
18
|
+
#
|
19
|
+
# @raise [Core::Helpers::Errors::BadRequest] if any of the parameters is not given
|
20
|
+
# @raise [Core::Helpers::Errors::NotFound] if the session or the application is not found
|
21
|
+
def create_from_session(session_id: nil, client_id: nil, **ignored)
|
22
|
+
session = Core.svc.sessions.get_by_id(session_id: session_id)
|
23
|
+
application = Core.svc.applications.get_by_id(client_id: client_id)
|
24
|
+
authorization = Core::Models::OAuth::Authorization.create(
|
25
|
+
account: session.account,
|
26
|
+
application: application
|
27
|
+
)
|
28
|
+
Core::Decorators::Authorization.new(authorization)
|
29
|
+
end
|
30
|
+
|
11
31
|
# Gets the authorization code corresponding to the provided value if it is linked to the
|
12
32
|
# application matching the provided credentials. Otherwise it raises errors.
|
13
33
|
#
|
data/lib/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: virtuatable-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Courtois
|
@@ -381,9 +381,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
381
381
|
version: '0'
|
382
382
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
383
383
|
requirements:
|
384
|
-
- - "
|
384
|
+
- - ">="
|
385
385
|
- !ruby/object:Gem::Version
|
386
|
-
version:
|
386
|
+
version: '0'
|
387
387
|
requirements: []
|
388
388
|
rubygems_version: 3.2.3
|
389
389
|
signing_key:
|