omniauth-krystal 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2daa4b31b516871e6746dfdf65b88debfb9865346643d45748da4a8d2512a931
4
+ data.tar.gz: f79f01ab1e94adc46019781b345fa7f5da953a0fccfc95c91161611f7c649017
5
+ SHA512:
6
+ metadata.gz: 7b36b81ab2773b9469d94460abe23addc1566448ca69e0d71d384193ac238aad7865b7fbb9d0f94706e1eaa1b9ada91d63ab78323e30b45b4093dd321bc6f302
7
+ data.tar.gz: 913f7259106ddd54f9217be23c520a4b07887e2c9c2c9d92b5d890d9e2442409b7b99036d4f4dcb9a2705c2fa7286c0fbe963a2089083760514fc9bf83a3df4c
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAuth
4
+ module Krystal
5
+
6
+ VERSION_FILE = File.expand_path('../../../VERSION', __dir__)
7
+ if File.file?(VERSION_FILE)
8
+ VERSION = File.read(VERSION_FILE).strip
9
+ else
10
+ VERSION = '0.0.0'
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth/strategies/oauth2'
4
+
5
+ module OmniAuth
6
+ module Strategies
7
+ class Krystal < OmniAuth::Strategies::OAuth2
8
+
9
+ option :name, "krystal"
10
+
11
+ option :client_options,
12
+ site: ENV.fetch("KRYSTAL_IDENTITY_API_URL", "https://identity.k.io/api/v1"),
13
+ authorize_url: ENV.fetch("KRYSTAL_IDENTITY_OAUTH_AUTHORIZE_URL", "https://oauth.identity.k.io/oauth2/auth"),
14
+ token_url: ENV.fetch("KRYSTAL_IDENTITY_OAUTH_TOKEN_URL", "https://oauth.identity.k.io/oauth2/token")
15
+
16
+
17
+ uid { raw_info["user"]["id"] }
18
+
19
+ info do
20
+ {
21
+ name: "#{raw_info['user']['first_name']} #{raw_info['user']['last_name']}",
22
+ email: raw_info["user"]["email_address"]
23
+ }
24
+ end
25
+
26
+ extra do
27
+ {
28
+ raw_info: raw_info,
29
+ scope: scope
30
+ }
31
+ end
32
+
33
+ def scope
34
+ access_token["scope"]
35
+ end
36
+
37
+ def callback_url
38
+ full_host + script_name + callback_path
39
+ end
40
+
41
+ def raw_info
42
+ @raw_info ||= access_token.get("user").parsed
43
+ end
44
+
45
+ end
46
+ end
47
+ end
48
+
49
+ OmniAuth.config.add_camelization "krystal", "Krystal"
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth/strategies/krystal'
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-krystal
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Adam Cooke
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-01-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: omniauth-oauth2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
41
+ description: OmniAuth strategy for Krystal Identity
42
+ email:
43
+ - adam@krystal.uk
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - lib/omniauth-krystal.rb
49
+ - lib/omniauth/krystal/version.rb
50
+ - lib/omniauth/strategies/krystal.rb
51
+ homepage: https://github.com/krystal/omniauth-krystal
52
+ licenses:
53
+ - MIT
54
+ metadata: {}
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ requirements: []
70
+ rubygems_version: 3.2.32
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: OmniAuth strategy for Krystal Identity
74
+ test_files: []