gamora 0.3.0 → 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/app/controllers/concerns/gamora/authorization_url.rb +37 -0
- data/app/controllers/gamora/authentication_controller.rb +5 -27
- data/app/controllers/gamora/callback_controller.rb +1 -0
- data/app/controllers/gamora/unauthentication_controller.rb +16 -0
- data/config/routes.rb +1 -0
- data/lib/gamora/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5603bf759444fee16ea4536a746c0aa1b215cc3c07f3e9405513605febeebe6
|
4
|
+
data.tar.gz: dba68b8d99573682f59dcc8705594fd698f5bd8e102009864123d56e57fc1ca6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30b06a7d4dfa731b547f9615dbf24082a07e64312db427477768117bf0ec2668901ae3a9905a10abd1ceef827f78d7da1c34f618da7e9c64bc021cc73fb1dc63
|
7
|
+
data.tar.gz: c14b734316cbd4a67487744f265684732048443f02112d3361772f44efd8446e4cb73cf95b5ca01fb904a1bb505e2b0c8e2b3d7c72e6902f6f65a7e95f68a7eb
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Gamora
|
2
|
+
module AuthorizationUrl
|
3
|
+
def authorization_url(params, extra_params = {})
|
4
|
+
default_params = {
|
5
|
+
scope: Configuration.default_scope,
|
6
|
+
theme: Configuration.default_theme,
|
7
|
+
prompt: Configuration.default_prompt,
|
8
|
+
strategy: Configuration.default_strategy,
|
9
|
+
branding: Configuration.default_branding,
|
10
|
+
ui_locales: Configuration.ui_locales.call
|
11
|
+
}
|
12
|
+
|
13
|
+
data =
|
14
|
+
default_params.
|
15
|
+
merge(extra_params).
|
16
|
+
merge(authorization_params(params)).
|
17
|
+
compact_blank
|
18
|
+
|
19
|
+
Client.from_config.auth_code.authorize_url(data)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def authorization_params(params)
|
25
|
+
params.permit(
|
26
|
+
:scope,
|
27
|
+
:state,
|
28
|
+
:theme,
|
29
|
+
:prompt,
|
30
|
+
:max_age,
|
31
|
+
:strategy,
|
32
|
+
:branding,
|
33
|
+
:ui_locales
|
34
|
+
)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -2,34 +2,12 @@
|
|
2
2
|
|
3
3
|
module Gamora
|
4
4
|
class AuthenticationController < ApplicationController
|
5
|
-
|
6
|
-
redirect_to authorization_url, allow_other_host: true
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
5
|
+
include AuthorizationUrl
|
10
6
|
|
11
|
-
def
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
prompt: Configuration.default_prompt,
|
16
|
-
strategy: Configuration.default_strategy,
|
17
|
-
branding: Configuration.default_branding,
|
18
|
-
ui_locales: Configuration.ui_locales.call
|
19
|
-
}.merge(authorization_params).compact_blank)
|
20
|
-
end
|
21
|
-
|
22
|
-
def authorization_params
|
23
|
-
params.permit(
|
24
|
-
:scope,
|
25
|
-
:state,
|
26
|
-
:theme,
|
27
|
-
:prompt,
|
28
|
-
:max_age,
|
29
|
-
:strategy,
|
30
|
-
:branding,
|
31
|
-
:ui_locales
|
32
|
-
)
|
7
|
+
def show
|
8
|
+
redirect_to authorization_url(params),
|
9
|
+
allow_other_host: true,
|
10
|
+
status: :see_other
|
33
11
|
end
|
34
12
|
end
|
35
13
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gamora
|
4
|
+
class UnauthenticationController < ApplicationController
|
5
|
+
include AuthorizationUrl
|
6
|
+
|
7
|
+
def show
|
8
|
+
session[:access_token] = nil
|
9
|
+
session[:refresh_token] = nil
|
10
|
+
|
11
|
+
redirect_to authorization_url(params, { max_age: 0 }),
|
12
|
+
allow_other_host: true,
|
13
|
+
status: :see_other
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/config/routes.rb
CHANGED
data/lib/gamora/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gamora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alejandro Gutiérrez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|
@@ -49,9 +49,11 @@ files:
|
|
49
49
|
- MIT-LICENSE
|
50
50
|
- README.md
|
51
51
|
- Rakefile
|
52
|
+
- app/controllers/concerns/gamora/authorization_url.rb
|
52
53
|
- app/controllers/gamora/application_controller.rb
|
53
54
|
- app/controllers/gamora/authentication_controller.rb
|
54
55
|
- app/controllers/gamora/callback_controller.rb
|
56
|
+
- app/controllers/gamora/unauthentication_controller.rb
|
55
57
|
- app/models/gamora/application_record.rb
|
56
58
|
- config/routes.rb
|
57
59
|
- lib/gamora.rb
|