code0-identities 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5454fae02745bc707943c9ec6e68f6c9f62fd0009c78a3dabc5a7b232eae6af
4
- data.tar.gz: d0fb4d77ec213dc693073ba5ce9e7cba591907fed450cde5cf6d109a8edc9552
3
+ metadata.gz: 20ecab70d2db2123f9c85738ae2897a9426eda9b4c13c4a9f455ddbf1b9dc423
4
+ data.tar.gz: 39c36eb33cf35810cf34a359c9ff1356afadfc1bb649bf597795d9aa5861fefc
5
5
  SHA512:
6
- metadata.gz: e07dad5a27f08b2df35eae0c5474c8c1595e8195b8cc5d156a6f104971991ec636ac7adb827c03be2e454f0d13907da0e6761413eb4dda09dca828e2a958dd2c
7
- data.tar.gz: '08c3f69cc47df910b84a08fad74916827be3213e3c0813858b96747bd01c324aa77b5af1cef786c5937c77afd86f2b85e9dd694cf8a5453323a420fedcfc9cf4'
6
+ metadata.gz: d0b802ab7def3ecc76192bd7c9207c4d2030a0a01cfa47410b1fe4d69ba4847dd4f9fcd5ed17c135cc1737e9efd758d8dc6298640f3363af7db88449c0d8ee7d
7
+ data.tar.gz: 546c6dc2d4b88510c3cfb4c2367395a11a1a2a11d76e013b95634ca892a092e2ee5b59421ff641a57a42bcfda586ab9a657c5f4f821703bb247b3edb84eadb5c
data/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ Copyright 2023-2026 Code0 UG (haftungsbeschränkt)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ AI Usage Restriction: Notwithstanding the permissions granted above, this Software and its source code may not be used, in whole or in part, for the purpose of training, fine-tuning, or developing artificial intelligence (AI) models or machine learning algorithms without prior written consent from the Copyright Holder.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -26,6 +26,10 @@ module Code0
26
26
 
27
27
  provider.load_identity(params)
28
28
  end
29
+
30
+ def [](provider_id)
31
+ providers[provider_id]
32
+ end
29
33
  end
30
34
  end
31
35
  end
@@ -10,6 +10,10 @@ module Code0
10
10
  @config_loader = config_loader
11
11
  end
12
12
 
13
+ def config_attributes
14
+ raise NotImplementedError
15
+ end
16
+
13
17
  def authorization_url
14
18
  raise NotImplementedError
15
19
  end
@@ -4,6 +4,13 @@ module Code0
4
4
  module Identities
5
5
  module Provider
6
6
  class Discord < BaseOauth
7
+ def config_attributes
8
+ {
9
+ required: %i[client_id client_secret redirect_uri],
10
+ optional: %i[provider_name]
11
+ }
12
+ end
13
+
7
14
  def token_url
8
15
  "https://discord.com/api/oauth2/token"
9
16
  end
@@ -4,6 +4,13 @@ module Code0
4
4
  module Identities
5
5
  module Provider
6
6
  class Github < BaseOauth
7
+ def config_attributes
8
+ {
9
+ required: %i[client_id client_secret redirect_uri],
10
+ optional: %i[provider_name]
11
+ }
12
+ end
13
+
7
14
  def token_url
8
15
  "https://github.com/login/oauth/access_token"
9
16
  end
@@ -4,6 +4,13 @@ module Code0
4
4
  module Identities
5
5
  module Provider
6
6
  class Gitlab < BaseOauth
7
+ def config_attributes
8
+ {
9
+ required: %i[base_url client_id client_secret redirect_uri],
10
+ optional: %i[provider_name]
11
+ }
12
+ end
13
+
7
14
  def base_url
8
15
  config[:base_url]
9
16
  end
@@ -4,6 +4,13 @@ module Code0
4
4
  module Identities
5
5
  module Provider
6
6
  class Google < BaseOauth
7
+ def config_attributes
8
+ {
9
+ required: %i[client_id client_secret redirect_uri],
10
+ optional: %i[provider_name]
11
+ }
12
+ end
13
+
7
14
  def base_url
8
15
  "https://accounts.google.com"
9
16
  end
@@ -4,6 +4,13 @@ module Code0
4
4
  module Identities
5
5
  module Provider
6
6
  class Microsoft < BaseOauth
7
+ def config_attributes
8
+ {
9
+ required: %i[client_id client_secret redirect_uri],
10
+ optional: %i[provider_name]
11
+ }
12
+ end
13
+
7
14
  def base_url
8
15
  "https://graph.microsoft.com/"
9
16
  end
@@ -4,6 +4,13 @@ module Code0
4
4
  module Identities
5
5
  module Provider
6
6
  class Oidc < BaseOauth
7
+ def config_attributes
8
+ {
9
+ required: %i[client_id client_secret redirect_uri token_url user_details_url authorization_url],
10
+ optional: %i[provider_name]
11
+ }
12
+ end
13
+
7
14
  def token_url
8
15
  config[:token_url]
9
16
  end
@@ -10,6 +10,13 @@ module Code0
10
10
  @config_loader = config_loader
11
11
  end
12
12
 
13
+ def config_attributes
14
+ {
15
+ required: %i[],
16
+ optional: %i[provider_name metadata_url settings response_settings attribute_statements]
17
+ }
18
+ end
19
+
13
20
  def authorization_url
14
21
  request = OneLogin::RubySaml::Authrequest.new
15
22
  request.create(create_settings)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Code0
4
4
  module Identities
5
- VERSION = "0.0.3"
5
+ VERSION = "0.0.4"
6
6
  end
7
7
  end
@@ -7,6 +7,8 @@ module Code0
7
7
 
8
8
  def initialize: () -> void
9
9
 
10
+ def []: (Symbol) -> Provider::BaseOauth
11
+
10
12
  def add_provider: (provider_type: Symbol, config: Proc | Hash[Symbol, any]) -> void
11
13
 
12
14
  def add_named_provider: (provider_id: Symbol, provider_type: Symbol, config: Proc | Hash[Symbol, any]) -> void
@@ -8,6 +8,8 @@ module Code0
8
8
 
9
9
  def authorization_url: () -> String
10
10
 
11
+ def config_attributes: -> { optional: Array[Symbol], required: Array[Symbol] }
12
+
11
13
  def token_url: () -> String
12
14
 
13
15
  def user_details_url: () -> String
@@ -4,6 +4,8 @@ module Code0
4
4
  class Saml
5
5
  def authorization_url: () -> String
6
6
 
7
+ def config_attributes: -> { optional: Array[Symbol], required: Array[Symbol] }
8
+
7
9
  def load_identity: (Hash[Symbol, any]) -> Identity
8
10
  end
9
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code0-identities
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dario Pranjic
@@ -144,7 +144,7 @@ files:
144
144
  - ".rspec"
145
145
  - ".rubocop.yml"
146
146
  - ".tool-versions"
147
- - LICENSE.txt
147
+ - LICENSE
148
148
  - README.md
149
149
  - Rakefile
150
150
  - lib/code0/identities.rb
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2024 TODO: Write your name
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.