omniauth_oidc 0.2.7 → 1.2.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/.rubocop.yml +2 -1
- data/CHANGELOG.md +124 -0
- data/LICENSE.txt +1 -1
- data/README.md +186 -71
- data/lib/omniauth/oidc/client.rb +86 -0
- data/lib/omniauth/oidc/config_fetcher.rb +114 -0
- data/lib/omniauth/oidc/errors.rb +20 -1
- data/lib/omniauth/oidc/http_client.rb +103 -0
- data/lib/omniauth/oidc/jwk_handler.rb +48 -0
- data/lib/omniauth/oidc/jwks_cache.rb +30 -0
- data/lib/omniauth/oidc/logging.rb +76 -0
- data/lib/omniauth/oidc/response_objects.rb +176 -0
- data/lib/omniauth/oidc/ttl_cache.rb +82 -0
- data/lib/omniauth/oidc/version.rb +1 -1
- data/lib/omniauth/strategies/oidc/callback.rb +137 -90
- data/lib/omniauth/strategies/oidc/redirect_uri.rb +59 -0
- data/lib/omniauth/strategies/oidc/request.rb +27 -19
- data/lib/omniauth/strategies/oidc/verify.rb +172 -68
- data/lib/omniauth/strategies/oidc.rb +97 -38
- data/lib/omniauth_oidc.rb +8 -0
- data/omniauth_oidc.gemspec +8 -5
- data/sig/omniauth_oidc.rbs +214 -1
- metadata +46 -34
data/sig/omniauth_oidc.rbs
CHANGED
|
@@ -1,4 +1,217 @@
|
|
|
1
1
|
module OmniauthOidc
|
|
2
2
|
VERSION: String
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
# Errors
|
|
5
|
+
class Error < RuntimeError
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class MissingCodeError < Error
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class MissingIdTokenError < Error
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class ConfigurationError < Error
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class MissingConfigurationError < ConfigurationError
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class TokenError < Error
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class TokenVerificationError < TokenError
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
class TokenExpiredError < TokenError
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class InvalidAlgorithmError < TokenError
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
class InvalidSignatureError < TokenError
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class InvalidIssuerError < TokenError
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
class InvalidAudienceError < TokenError
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
class InvalidNonceError < TokenError
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class JwksError < Error
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
class JwksFetchError < JwksError
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
class KeyNotFoundError < JwksError
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# HTTP Client
|
|
54
|
+
class HttpClient
|
|
55
|
+
class HttpError < StandardError
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
MAX_REDIRECTS: Integer
|
|
59
|
+
OPEN_TIMEOUT: Integer
|
|
60
|
+
READ_TIMEOUT: Integer
|
|
61
|
+
WRITE_TIMEOUT: Integer
|
|
62
|
+
|
|
63
|
+
def self.get: (String url, ?headers: Hash[String, String]) -> Hash[String, untyped]
|
|
64
|
+
def self.post: (String url, ?body: String?, ?headers: Hash[String, String]) -> Hash[String, untyped]
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# OIDC Client
|
|
68
|
+
class Client
|
|
69
|
+
attr_accessor identifier: String?
|
|
70
|
+
attr_accessor secret: String?
|
|
71
|
+
attr_accessor authorization_endpoint: String?
|
|
72
|
+
attr_accessor token_endpoint: String?
|
|
73
|
+
attr_accessor userinfo_endpoint: String?
|
|
74
|
+
attr_accessor host: String?
|
|
75
|
+
attr_accessor redirect_uri: String?
|
|
76
|
+
|
|
77
|
+
def initialize: (?Hash[Symbol | String, untyped] options) -> void
|
|
78
|
+
def authorization_uri: (?Hash[Symbol, untyped] params) -> String
|
|
79
|
+
def access_token!: (?Hash[Symbol, untyped] params) -> ResponseObjects::AccessToken
|
|
80
|
+
def userinfo!: (String access_token) -> ResponseObjects::UserInfo
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# JWK Handler
|
|
84
|
+
class JwkHandler
|
|
85
|
+
class KeyWithId
|
|
86
|
+
attr_accessor kid: String?
|
|
87
|
+
attr_accessor keypair: OpenSSL::PKey::PKey
|
|
88
|
+
|
|
89
|
+
def initialize: (?kid: String?, ?keypair: OpenSSL::PKey::PKey) -> void
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def self.parse_jwks: (String | Hash[String, untyped] | nil jwks_data) -> Array[KeyWithId]?
|
|
93
|
+
def self.jwk_to_key: (Hash[String, untyped] jwk_data) -> KeyWithId?
|
|
94
|
+
def self.find_key: (Array[KeyWithId] keys, ?String? kid) -> OpenSSL::PKey::PKey?
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Thread-safe TTL cache
|
|
98
|
+
class TtlCache
|
|
99
|
+
class Entry
|
|
100
|
+
attr_accessor value: untyped
|
|
101
|
+
attr_accessor fetched_at: Time
|
|
102
|
+
|
|
103
|
+
def initialize: (?value: untyped, ?fetched_at: Time) -> void
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
attr_reader ttl: Numeric
|
|
107
|
+
|
|
108
|
+
def initialize: (ttl: Numeric, ?name: String) -> void
|
|
109
|
+
def fetch: (String key, ?force_refresh: bool, ?ttl: Numeric?, ?min_age: Numeric) { () -> untyped } -> untyped
|
|
110
|
+
def valid?: (String key) -> bool
|
|
111
|
+
def invalidate: (String key) -> void
|
|
112
|
+
def clear!: () -> void
|
|
113
|
+
def ttl=: (Numeric value) -> void
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# JWKS Cache
|
|
117
|
+
class JwksCache < TtlCache
|
|
118
|
+
DEFAULT_TTL: Integer
|
|
119
|
+
|
|
120
|
+
def self.instance: () -> JwksCache
|
|
121
|
+
def self.clear!: () -> void
|
|
122
|
+
def self.invalidate: (String jwks_uri) -> void
|
|
123
|
+
|
|
124
|
+
def initialize: (?ttl: Numeric) -> void
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Config Fetcher
|
|
128
|
+
class ConfigFetcher
|
|
129
|
+
DEFAULT_CACHE_TTL: Integer
|
|
130
|
+
STANDARD_FIELDS: Array[Symbol]
|
|
131
|
+
REQUIRED_FIELDS: Array[Symbol]
|
|
132
|
+
|
|
133
|
+
class Config
|
|
134
|
+
def initialize: (?Hash[Symbol | String, untyped] attributes) -> void
|
|
135
|
+
def []: (String | Symbol key) -> untyped
|
|
136
|
+
def []=: (String | Symbol key, untyped value) -> untyped
|
|
137
|
+
def respond_to_missing?: (Symbol method_name, ?bool include_private) -> bool
|
|
138
|
+
def issuer: () -> String?
|
|
139
|
+
def authorization_endpoint: () -> String?
|
|
140
|
+
def token_endpoint: () -> String?
|
|
141
|
+
def userinfo_endpoint: () -> String?
|
|
142
|
+
def jwks_uri: () -> String?
|
|
143
|
+
def end_session_endpoint: () -> String?
|
|
144
|
+
def scopes_supported: () -> Array[String]?
|
|
145
|
+
def id_token_signing_alg_values_supported: () -> Array[String]?
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def self.fetch: (String endpoint_url, ?max_retries: Integer) -> Config
|
|
149
|
+
def self.fetch_cached: (String endpoint_url, ?ttl: Numeric) -> Config
|
|
150
|
+
def self.clear_cache!: () -> void
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Response Objects
|
|
154
|
+
module ResponseObjects
|
|
155
|
+
class IdToken
|
|
156
|
+
attr_reader raw_attributes: Hash[String, untyped]
|
|
157
|
+
|
|
158
|
+
def initialize: (?Hash[String, untyped] attributes) -> void
|
|
159
|
+
def sub: () -> String?
|
|
160
|
+
def iss: () -> String?
|
|
161
|
+
def aud: () -> (String | Array[String])?
|
|
162
|
+
def exp: () -> Integer?
|
|
163
|
+
def iat: () -> Integer?
|
|
164
|
+
def nonce: () -> String?
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
class UserInfo
|
|
168
|
+
attr_reader raw_attributes: Hash[String, untyped]
|
|
169
|
+
|
|
170
|
+
def initialize: (?Hash[String, untyped] attributes) -> void
|
|
171
|
+
def sub: () -> String?
|
|
172
|
+
def name: () -> String?
|
|
173
|
+
def given_name: () -> String?
|
|
174
|
+
def family_name: () -> String?
|
|
175
|
+
def middle_name: () -> String?
|
|
176
|
+
def nickname: () -> String?
|
|
177
|
+
def preferred_username: () -> String?
|
|
178
|
+
def profile: () -> String?
|
|
179
|
+
def picture: () -> String?
|
|
180
|
+
def website: () -> String?
|
|
181
|
+
def email: () -> String?
|
|
182
|
+
def email_verified: () -> bool?
|
|
183
|
+
def gender: () -> String?
|
|
184
|
+
def birthdate: () -> String?
|
|
185
|
+
def zoneinfo: () -> String?
|
|
186
|
+
def locale: () -> String?
|
|
187
|
+
def phone_number: () -> String?
|
|
188
|
+
def phone_number_verified: () -> bool?
|
|
189
|
+
def address: () -> Hash[String, untyped]?
|
|
190
|
+
def updated_at: () -> Integer?
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
class AccessToken
|
|
194
|
+
attr_reader access_token: String?
|
|
195
|
+
attr_reader token_type: String?
|
|
196
|
+
attr_reader expires_in: Integer?
|
|
197
|
+
attr_reader refresh_token: String?
|
|
198
|
+
attr_reader scope: String?
|
|
199
|
+
attr_reader id_token: String?
|
|
200
|
+
|
|
201
|
+
def initialize: (?Hash[String | Symbol, untyped] attributes) -> void
|
|
202
|
+
def to_h: () -> Hash[String, untyped]
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Logging
|
|
207
|
+
module Logging
|
|
208
|
+
def self.logger: () -> Logger
|
|
209
|
+
def self.logger=: (Logger logger) -> void
|
|
210
|
+
def self.log_level=: (Integer level) -> void
|
|
211
|
+
def self.instrument: (String event_name, ?Hash[Symbol, untyped] payload) ?{ (Hash[Symbol, untyped]) -> untyped } -> untyped
|
|
212
|
+
def self.debug: (String message, ?Hash[Symbol, untyped] context) -> void
|
|
213
|
+
def self.info: (String message, ?Hash[Symbol, untyped] context) -> void
|
|
214
|
+
def self.warn: (String message, ?Hash[Symbol, untyped] context) -> void
|
|
215
|
+
def self.error: (String message, ?Hash[Symbol, untyped] context) -> void
|
|
216
|
+
end
|
|
4
217
|
end
|
metadata
CHANGED
|
@@ -1,71 +1,73 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omniauth_oidc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Suleyman Musayev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-11-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: jwt
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
20
|
-
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - ">="
|
|
19
|
+
version: 2.10.3
|
|
20
|
+
- - "!="
|
|
25
21
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
27
|
-
-
|
|
28
|
-
name: omniauth
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
22
|
+
version: 3.0.0
|
|
23
|
+
- - "!="
|
|
32
24
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
34
|
-
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - ">="
|
|
25
|
+
version: 3.1.0
|
|
26
|
+
- - "!="
|
|
39
27
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
- - ">="
|
|
28
|
+
version: 3.1.1
|
|
29
|
+
- - "!="
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: 3.1.2
|
|
32
|
+
- - "<"
|
|
46
33
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '0'
|
|
34
|
+
version: '4.0'
|
|
48
35
|
type: :runtime
|
|
49
36
|
prerelease: false
|
|
50
37
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
38
|
requirements:
|
|
52
39
|
- - ">="
|
|
53
40
|
- !ruby/object:Gem::Version
|
|
54
|
-
version:
|
|
41
|
+
version: 2.10.3
|
|
42
|
+
- - "!="
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
version: 3.0.0
|
|
45
|
+
- - "!="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 3.1.0
|
|
48
|
+
- - "!="
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: 3.1.1
|
|
51
|
+
- - "!="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 3.1.2
|
|
54
|
+
- - "<"
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
version: '4.0'
|
|
55
57
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
58
|
+
name: omniauth
|
|
57
59
|
requirement: !ruby/object:Gem::Requirement
|
|
58
60
|
requirements:
|
|
59
|
-
- - "
|
|
61
|
+
- - "~>"
|
|
60
62
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
63
|
+
version: '2.1'
|
|
62
64
|
type: :runtime
|
|
63
65
|
prerelease: false
|
|
64
66
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
67
|
requirements:
|
|
66
|
-
- - "
|
|
68
|
+
- - "~>"
|
|
67
69
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
70
|
+
version: '2.1'
|
|
69
71
|
description: |-
|
|
70
72
|
Omniauth strategy to authenticate and retrieve user data as a client using OpenID Connect (OIDC)
|
|
71
73
|
suited for multiple OIDC providers.
|
|
@@ -81,10 +83,19 @@ files:
|
|
|
81
83
|
- LICENSE.txt
|
|
82
84
|
- README.md
|
|
83
85
|
- Rakefile
|
|
86
|
+
- lib/omniauth/oidc/client.rb
|
|
87
|
+
- lib/omniauth/oidc/config_fetcher.rb
|
|
84
88
|
- lib/omniauth/oidc/errors.rb
|
|
89
|
+
- lib/omniauth/oidc/http_client.rb
|
|
90
|
+
- lib/omniauth/oidc/jwk_handler.rb
|
|
91
|
+
- lib/omniauth/oidc/jwks_cache.rb
|
|
92
|
+
- lib/omniauth/oidc/logging.rb
|
|
93
|
+
- lib/omniauth/oidc/response_objects.rb
|
|
94
|
+
- lib/omniauth/oidc/ttl_cache.rb
|
|
85
95
|
- lib/omniauth/oidc/version.rb
|
|
86
96
|
- lib/omniauth/strategies/oidc.rb
|
|
87
97
|
- lib/omniauth/strategies/oidc/callback.rb
|
|
98
|
+
- lib/omniauth/strategies/oidc/redirect_uri.rb
|
|
88
99
|
- lib/omniauth/strategies/oidc/request.rb
|
|
89
100
|
- lib/omniauth/strategies/oidc/verify.rb
|
|
90
101
|
- lib/omniauth_oidc.rb
|
|
@@ -97,6 +108,7 @@ metadata:
|
|
|
97
108
|
homepage_uri: https://github.com/msuliq/omniauth_oidc
|
|
98
109
|
source_code_uri: https://github.com/msuliq/omniauth_oidc
|
|
99
110
|
changelog_uri: https://github.com/msuliq/omniauth_oidc/blob/main/CHANGELOG.md
|
|
111
|
+
rubygems_mfa_required: 'true'
|
|
100
112
|
post_install_message:
|
|
101
113
|
rdoc_options: []
|
|
102
114
|
require_paths:
|