omniauth_openid_federation 2.1.0 → 2.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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -15
  3. data/README.md +36 -11
  4. data/app/controllers/omniauth_openid_federation/federation_controller.rb +21 -55
  5. data/config/polyrun_coverage.yml +1 -1
  6. data/config/routes.rb +3 -0
  7. data/examples/README_INTEGRATION_TESTING.md +3 -3
  8. data/examples/README_MOCK_OP.md +11 -11
  9. data/examples/integration_test_flow.rb +5 -5
  10. data/examples/jobs/README.md +11 -11
  11. data/examples/mock_op_server.rb +1 -1
  12. data/examples/relying_party_key_rotation.rb.example +29 -0
  13. data/lib/omniauth_openid_federation/client_keys.rb +38 -0
  14. data/lib/omniauth_openid_federation/constants.rb +8 -0
  15. data/lib/omniauth_openid_federation/controller.rb +34 -0
  16. data/lib/omniauth_openid_federation/engine.rb +7 -6
  17. data/lib/omniauth_openid_federation/jwks/normalizer.rb +8 -2
  18. data/lib/omniauth_openid_federation/jwt_response_decoder.rb +9 -4
  19. data/lib/omniauth_openid_federation/key_resolver.rb +36 -0
  20. data/lib/omniauth_openid_federation/oidc_client.rb +17 -2
  21. data/lib/omniauth_openid_federation/rack_endpoint.rb +5 -5
  22. data/lib/omniauth_openid_federation/rails.rb +25 -0
  23. data/lib/omniauth_openid_federation/relying_party_key_store.rb +110 -0
  24. data/lib/omniauth_openid_federation/strategy/authorization_request.rb +5 -3
  25. data/lib/omniauth_openid_federation/strategy/client_construction.rb +14 -7
  26. data/lib/omniauth_openid_federation/strategy/id_token_decoding.rb +7 -4
  27. data/lib/omniauth_openid_federation/strategy/userinfo_decoding.rb +7 -4
  28. data/lib/omniauth_openid_federation/strategy.rb +4 -0
  29. data/lib/omniauth_openid_federation/tasks/callback_processor.rb +7 -7
  30. data/lib/omniauth_openid_federation/tasks/local_endpoint_tester.rb +3 -3
  31. data/lib/omniauth_openid_federation/utils.rb +21 -14
  32. data/lib/omniauth_openid_federation/validators.rb +8 -14
  33. data/lib/omniauth_openid_federation/version.rb +1 -1
  34. data/lib/omniauth_openid_federation.rb +5 -1
  35. data/lib/tasks/omniauth_openid_federation.rake +96 -96
  36. metadata +9 -3
@@ -12,7 +12,7 @@ namespace :openid_federation do
12
12
  output_file = args[:output_file] || ENV["ENTITY_STATEMENT_OUTPUT"] || "config/provider-entity-statement.jwt"
13
13
 
14
14
  unless url
15
- puts "❌ Entity statement URL is required"
15
+ puts "Error: Entity statement URL is required"
16
16
  puts " Usage: rake openid_federation:fetch_entity_statement[URL,FINGERPRINT,OUTPUT_FILE]"
17
17
  puts " Or set: ENTITY_STATEMENT_URL, ENTITY_STATEMENT_FINGERPRINT, ENTITY_STATEMENT_OUTPUT"
18
18
  exit 1
@@ -32,11 +32,11 @@ namespace :openid_federation do
32
32
  output_file: output_file
33
33
  )
34
34
 
35
- puts "✅ Entity statement saved to: #{result[:output_path]}"
36
- puts "✅ Fingerprint: #{result[:fingerprint]}"
35
+ puts "OK: Entity statement saved to: #{result[:output_path]}"
36
+ puts "OK: Fingerprint: #{result[:fingerprint]}"
37
37
 
38
38
  metadata = result[:metadata]
39
- puts "\n📋 Entity Statement Metadata:"
39
+ puts "\nEntity Statement Metadata:"
40
40
  puts " Issuer: #{metadata[:issuer]}"
41
41
  puts " Authorization Endpoint: #{metadata[:metadata][:openid_provider][:authorization_endpoint]}"
42
42
  puts " Token Endpoint: #{metadata[:metadata][:openid_provider][:token_endpoint]}"
@@ -46,14 +46,14 @@ namespace :openid_federation do
46
46
  puts " Signed JWKS URI: #{metadata[:metadata][:openid_provider][:signed_jwks_uri]}"
47
47
  end
48
48
  rescue OmniauthOpenidFederation::Federation::EntityStatement::FetchError => e
49
- puts "❌ Error fetching entity statement: #{e.message}"
49
+ puts "Error fetching entity statement: #{e.message}"
50
50
  exit 1
51
51
  rescue OmniauthOpenidFederation::Federation::EntityStatement::ValidationError => e
52
- puts "❌ Validation error: #{e.message}"
53
- puts " ⚠️ Entity statement fingerprint mismatch. Check provider documentation."
52
+ puts "Validation error: #{e.message}"
53
+ puts " Warning: Entity statement fingerprint mismatch. Check provider documentation."
54
54
  exit 1
55
55
  rescue => e
56
- puts "❌ Unexpected error: #{e.message}"
56
+ puts "Unexpected error: #{e.message}"
57
57
  puts " #{e.class}: #{e.backtrace.first}"
58
58
  exit 1
59
59
  end
@@ -73,13 +73,13 @@ namespace :openid_federation do
73
73
  )
74
74
 
75
75
  if expected_fingerprint
76
- puts "✅ Fingerprint matches: #{result[:fingerprint]}"
76
+ puts "OK: Fingerprint matches: #{result[:fingerprint]}"
77
77
  else
78
- puts "📋 Entity statement fingerprint: #{result[:fingerprint]}"
78
+ puts "Entity statement fingerprint: #{result[:fingerprint]}"
79
79
  end
80
80
 
81
81
  metadata = result[:metadata]
82
- puts "\n📋 Entity Statement Metadata:"
82
+ puts "\nEntity Statement Metadata:"
83
83
  puts " Issuer: #{metadata[:issuer]}"
84
84
  puts " Authorization Endpoint: #{metadata[:metadata][:openid_provider][:authorization_endpoint]}"
85
85
  puts " Token Endpoint: #{metadata[:metadata][:openid_provider][:token_endpoint]}"
@@ -89,13 +89,13 @@ namespace :openid_federation do
89
89
  puts " Signed JWKS URI: #{metadata[:metadata][:openid_provider][:signed_jwks_uri]}"
90
90
  end
91
91
  rescue OmniauthOpenidFederation::ConfigurationError => e
92
- puts "❌ #{e.message}"
92
+ puts "Error: #{e.message}"
93
93
  exit 1
94
94
  rescue OmniauthOpenidFederation::ValidationError => e
95
- puts "❌ Validation error: #{e.message}"
95
+ puts "Validation error: #{e.message}"
96
96
  exit 1
97
97
  rescue => e
98
- puts "❌ Error: #{e.message}"
98
+ puts "Error: #{e.message}"
99
99
  puts " #{e.class}: #{e.backtrace.first}"
100
100
  exit 1
101
101
  end
@@ -109,7 +109,7 @@ namespace :openid_federation do
109
109
  output_file = args[:output_file] || ENV["JWKS_OUTPUT"] || "config/provider-jwks.json"
110
110
 
111
111
  unless jwks_uri
112
- puts "❌ JWKS URI is required"
112
+ puts "Error: JWKS URI is required"
113
113
  puts " Usage: rake openid_federation:fetch_jwks[JWKS_URI,OUTPUT_FILE]"
114
114
  puts " Or set: JWKS_URI, JWKS_OUTPUT"
115
115
  exit 1
@@ -125,8 +125,8 @@ namespace :openid_federation do
125
125
  )
126
126
 
127
127
  jwks = result[:jwks]
128
- puts "✅ JWKS saved to: #{result[:output_path]}"
129
- puts "✅ Keys found: #{jwks&.[]("keys")&.length || 0}"
128
+ puts "OK: JWKS saved to: #{result[:output_path]}"
129
+ puts "OK: Keys found: #{jwks&.[]("keys")&.length || 0}"
130
130
 
131
131
  jwks&.[]("keys")&.each_with_index do |key, index|
132
132
  puts " Key #{index + 1}:"
@@ -135,7 +135,7 @@ namespace :openid_federation do
135
135
  puts " - use: #{key["use"] || "not specified"}"
136
136
  end
137
137
  rescue => e
138
- puts "❌ Error fetching JWKS: #{e.message}"
138
+ puts "Error fetching JWKS: #{e.message}"
139
139
  puts " #{e.class}: #{e.backtrace.first}"
140
140
  exit 1
141
141
  end
@@ -151,13 +151,13 @@ namespace :openid_federation do
151
151
  begin
152
152
  metadata = OmniauthOpenidFederation::TasksHelper.parse_entity_statement(file_path: file_path)
153
153
 
154
- puts "📋 Entity Statement Metadata:"
154
+ puts "Entity Statement Metadata:"
155
155
  puts JSON.pretty_generate(metadata)
156
156
  rescue OmniauthOpenidFederation::ConfigurationError, OmniauthOpenidFederation::ValidationError => e
157
- puts "❌ Error: #{e.message}"
157
+ puts "Error: #{e.message}"
158
158
  exit 1
159
159
  rescue => e
160
- puts "❌ Error parsing entity statement: #{e.message}"
160
+ puts "Error parsing entity statement: #{e.message}"
161
161
  puts " #{e.class}: #{e.backtrace.first}"
162
162
  exit 1
163
163
  end
@@ -189,7 +189,7 @@ namespace :openid_federation do
189
189
  output_dir: output_dir
190
190
  )
191
191
 
192
- puts "\n✅ Keys generated successfully:"
192
+ puts "\nOK: Keys generated successfully:"
193
193
  if key_type == "single"
194
194
  puts " Private key: #{result[:private_key_path]}"
195
195
  else
@@ -198,23 +198,23 @@ namespace :openid_federation do
198
198
  end
199
199
 
200
200
  puts " Public JWKS: #{result[:public_jwks_path]}"
201
- puts "\n📋 Send this JWKS to your provider for client registration:"
201
+ puts "\nSend this JWKS to your provider for client registration:"
202
202
  separator = "=" * 70
203
203
  puts separator
204
204
  puts JSON.pretty_generate(result[:jwks])
205
205
  puts separator
206
206
 
207
- puts "\n⚠️ SECURITY WARNING:"
208
- puts " - Keep private keys secure! Never commit them to version control."
207
+ puts "\nSECURITY WARNING:"
208
+ puts " - Keep private keys secure. Never commit them to version control."
209
209
  puts " - Add to .gitignore: config/*-private-key.pem"
210
210
  puts " - Prefer storing secrets in secret vaults (1Password, HashiCorp Vault, etc.)"
211
211
  puts " - Only send the public JWKS (client-jwks.json) to your provider"
212
212
  rescue ArgumentError => e
213
- puts "❌ #{e.message}"
213
+ puts "Error: #{e.message}"
214
214
  puts " Valid options: 'single' (one key for both signing/encryption) or 'separate' (two keys)"
215
215
  exit 1
216
216
  rescue => e
217
- puts "❌ Error generating keys: #{e.message}"
217
+ puts "Error generating keys: #{e.message}"
218
218
  puts " #{e.class}: #{e.backtrace.first}"
219
219
  exit 1
220
220
  end
@@ -243,23 +243,23 @@ namespace :openid_federation do
243
243
  key_status = result[:key_status]
244
244
  validation_warnings = result[:validation_warnings] || []
245
245
 
246
- puts "📥 Step 1: Fetching entity statement..."
246
+ puts "Step 1: Fetching entity statement..."
247
247
  if validation_warnings.any? { |w| w.include?("fetch") || w.include?("Fetch") }
248
- puts "⚠️ Entity statement fetched with warnings"
248
+ puts "Warning: Entity statement fetched with warnings"
249
249
  else
250
- puts "✅ Entity statement fetched successfully"
250
+ puts "OK: Entity statement fetched successfully"
251
251
  end
252
252
  puts " Fingerprint: #{entity_statement.fingerprint}"
253
253
  puts
254
254
 
255
- puts "📋 Step 2: Parsing entity statement..."
255
+ puts "Step 2: Parsing entity statement..."
256
256
  if validation_warnings.any?
257
- puts "⚠️ Entity statement parsed with validation warnings:"
257
+ puts "Warning: Entity statement parsed with validation warnings:"
258
258
  validation_warnings.each do |warning|
259
- puts " ⚠️ #{warning}"
259
+ puts " Warning: #{warning}"
260
260
  end
261
261
  else
262
- puts "✅ Entity statement parsed successfully"
262
+ puts "OK: Entity statement parsed successfully"
263
263
  end
264
264
  puts " Issuer: #{metadata[:issuer]}"
265
265
  puts " Subject: #{metadata[:sub]}"
@@ -269,7 +269,7 @@ namespace :openid_federation do
269
269
 
270
270
  # Key status information
271
271
  if key_status
272
- puts "🔑 Key Configuration:"
272
+ puts "Key Configuration:"
273
273
  case key_status[:type]
274
274
  when :single
275
275
  puts " Status: Single key detected (#{key_status[:count]} key(s))"
@@ -282,7 +282,7 @@ namespace :openid_federation do
282
282
  puts
283
283
  end
284
284
 
285
- puts "🔗 Step 3: Testing endpoints from entity statement..."
285
+ puts "Step 3: Testing endpoints from entity statement..."
286
286
  puts " Found #{results.length} endpoint(s) to test"
287
287
  puts
288
288
 
@@ -291,9 +291,9 @@ namespace :openid_federation do
291
291
  case result_data[:status]
292
292
  when :success
293
293
  if result_data[:keys]
294
- puts " ✅ JWKS fetched successfully (#{result_data[:keys]} key(s))"
294
+ puts " OK: JWKS fetched successfully (#{result_data[:keys]} key(s))"
295
295
  else
296
- puts " ✅ Endpoint accessible (HTTP #{result_data[:code]})"
296
+ puts " OK: Endpoint accessible (HTTP #{result_data[:code]})"
297
297
  end
298
298
  when :warning
299
299
  warning_msg = "HTTP #{result_data[:code]}"
@@ -301,9 +301,9 @@ namespace :openid_federation do
301
301
  body_text = result_data[:body].strip
302
302
  warning_msg += " - #{body_text}" if body_text.length > 0
303
303
  end
304
- puts " ⚠️ Endpoint returned #{warning_msg}"
304
+ puts " Warning: Endpoint returned #{warning_msg}"
305
305
  when :error
306
- puts " ❌ Error: #{result_data[:message]}"
306
+ puts " Error: #{result_data[:message]}"
307
307
  end
308
308
  puts
309
309
  end
@@ -321,16 +321,16 @@ namespace :openid_federation do
321
321
  results.each do |name, result_data|
322
322
  case result_data[:status]
323
323
  when :success
324
- puts "✅ #{name}: #{result_data[:keys] ? "#{result_data[:keys]} key(s)" : "OK"}"
324
+ puts "OK: #{name}: #{result_data[:keys] ? "#{result_data[:keys]} key(s)" : "OK"}"
325
325
  when :warning
326
326
  warning_msg = "HTTP #{result_data[:code]}"
327
327
  if result_data[:code] == "404" && result_data[:body]
328
328
  body_text = result_data[:body].strip
329
329
  warning_msg += " - #{body_text}" if body_text.length > 0
330
330
  end
331
- puts "⚠️ #{name}: #{warning_msg}"
331
+ puts "Warning: #{name}: #{warning_msg}"
332
332
  when :error
333
- puts "❌ #{name}: #{result_data[:message]}"
333
+ puts "Error: #{name}: #{result_data[:message]}"
334
334
  end
335
335
  end
336
336
 
@@ -342,10 +342,10 @@ namespace :openid_federation do
342
342
  end
343
343
  puts
344
344
  if validation_warnings.any?
345
- puts "⚠️ Entity statement has validation warnings (see above)."
345
+ puts "Warning: Entity statement has validation warnings (see above)."
346
346
  puts " Review the warnings and fix any issues before deploying to production."
347
347
  else
348
- puts "ℹ️ Entity statement parsed successfully, but no testable endpoints found."
348
+ puts "Note: Entity statement parsed successfully, but no testable endpoints found."
349
349
  end
350
350
  else
351
351
  puts "Total: #{success_count} successful, #{warning_count} warning(s), #{error_count} error(s)"
@@ -355,21 +355,21 @@ namespace :openid_federation do
355
355
  puts
356
356
 
357
357
  if error_count > 0
358
- puts "⚠️ Some endpoints failed. Check the errors above."
358
+ puts "Warning: Some endpoints failed. Check the errors above."
359
359
  exit 1
360
360
  elsif validation_warnings.any?
361
- puts "⚠️ Entity statement has validation warnings (see above), but endpoints were tested."
361
+ puts "Warning: Entity statement has validation warnings (see above), but endpoints were tested."
362
362
  puts " Review the warnings and fix any issues before deploying to production."
363
363
  else
364
- puts "✅ All endpoints tested successfully!"
364
+ puts "OK: All endpoints tested successfully!"
365
365
  end
366
366
  end
367
367
  rescue OmniauthOpenidFederation::Federation::EntityStatement::FetchError => e
368
- puts "❌ Error fetching entity statement: #{e.message}"
368
+ puts "Error fetching entity statement: #{e.message}"
369
369
  puts " Make sure the server is running and the endpoint is accessible"
370
370
  exit 1
371
371
  rescue => e
372
- puts "❌ Unexpected error: #{e.message}"
372
+ puts "Unexpected error: #{e.message}"
373
373
  puts " #{e.class}: #{e.backtrace.first(3).join("\n ")}"
374
374
  exit 1
375
375
  end
@@ -415,7 +415,7 @@ namespace :openid_federation do
415
415
 
416
416
  # Validate required parameters
417
417
  unless login_page_url
418
- puts "❌ LOGIN_PAGE_URL is required"
418
+ puts "Error: LOGIN_PAGE_URL is required"
419
419
  puts " Set it as an environment variable or pass as first argument:"
420
420
  puts " rake openid_federation:test_authentication_flow[https://example.com/login]"
421
421
  exit 1
@@ -427,26 +427,26 @@ namespace :openid_federation do
427
427
  begin
428
428
  private_key = OpenSSL::PKey::RSA.new(private_key_pem)
429
429
  rescue => e
430
- puts "❌ Failed to parse private key from PRIVATE_KEY or PRIVATE_KEY_BASE64: #{e.message}"
430
+ puts "Error: Failed to parse private key from PRIVATE_KEY or PRIVATE_KEY_BASE64: #{e.message}"
431
431
  exit 1
432
432
  end
433
433
  elsif private_key_path
434
434
  begin
435
435
  private_key = OpenSSL::PKey::RSA.new(File.read(private_key_path))
436
436
  rescue => e
437
- puts "❌ Failed to load private key from #{private_key_path}: #{e.message}"
437
+ puts "Error: Failed to load private key from #{private_key_path}: #{e.message}"
438
438
  exit 1
439
439
  end
440
440
  end
441
441
 
442
442
  unless private_key
443
- puts "❌ Private key is required"
443
+ puts "Error: Private key is required"
444
444
  puts " Set one of: PRIVATE_KEY, PRIVATE_KEY_BASE64, or PRIVATE_KEY_PATH"
445
445
  exit 1
446
446
  end
447
447
 
448
448
  unless client_id
449
- puts "❌ CLIENT_ID is required"
449
+ puts "Error: CLIENT_ID is required"
450
450
  puts " Set it as an environment variable: CLIENT_ID=your_client_id"
451
451
  exit 1
452
452
  end
@@ -456,42 +456,42 @@ namespace :openid_federation do
456
456
  # Try to fetch from well-known endpoint
457
457
  begin
458
458
  well_known_url = "#{base_url}/.well-known/openid-federation"
459
- puts "📥 Attempting to fetch entity statement from: #{well_known_url}"
459
+ puts "Attempting to fetch entity statement from: #{well_known_url}"
460
460
  response = OmniauthOpenidFederation::HttpClient.get(well_known_url, timeout: 5, max_retries: 0)
461
461
  if response.status.success?
462
462
  entity_statement_path = "/tmp/entity_statement_#{Time.now.to_i}.json"
463
463
  File.write(entity_statement_path, response.body.to_s)
464
- puts " ✅ Entity statement cached to: #{entity_statement_path}"
464
+ puts " OK: Entity statement cached to: #{entity_statement_path}"
465
465
  end
466
466
  rescue => e
467
- puts " ⚠️ Could not fetch entity statement: #{e.message}"
467
+ puts " Warning: Could not fetch entity statement: #{e.message}"
468
468
  puts " Set ENTITY_STATEMENT_URL or ENTITY_STATEMENT_PATH manually"
469
469
  end
470
470
  end
471
471
 
472
472
  # Display configuration status
473
- puts "📋 Configuration Status:"
474
- puts " ✅ Client ID: #{client_id}"
475
- puts " ✅ Redirect URI: #{redirect_uri}"
476
- puts " ✅ Private Key: Loaded"
473
+ puts "Configuration Status:"
474
+ puts " OK: Client ID: #{client_id}"
475
+ puts " OK: Redirect URI: #{redirect_uri}"
476
+ puts " OK: Private Key: Loaded"
477
477
  if entity_statement_url
478
- puts " ✅ Provider Entity Statement URL: #{entity_statement_url}"
478
+ puts " OK: Provider Entity Statement URL: #{entity_statement_url}"
479
479
  elsif entity_statement_path
480
- puts " ✅ Provider Entity Statement Path: #{entity_statement_path}"
480
+ puts " OK: Provider Entity Statement Path: #{entity_statement_path}"
481
481
  else
482
- puts " ⚠️ Provider Entity Statement: Not configured"
482
+ puts " Warning: Provider Entity Statement: Not configured"
483
483
  end
484
484
  if client_entity_statement_url
485
- puts " ✅ Client Entity Statement URL: #{client_entity_statement_url}"
485
+ puts " OK: Client Entity Statement URL: #{client_entity_statement_url}"
486
486
  elsif client_entity_statement_path
487
- puts " ✅ Client Entity Statement Path: #{client_entity_statement_path}"
487
+ puts " OK: Client Entity Statement Path: #{client_entity_statement_path}"
488
488
  end
489
489
  puts
490
490
 
491
491
  begin
492
492
  # Step 1: Request authorization URL
493
493
  puts "=" * 80
494
- puts "📋 Step 1: Requesting Authorization URL"
494
+ puts "Step 1: Requesting Authorization URL"
495
495
  puts "-" * 80
496
496
  puts
497
497
 
@@ -502,26 +502,26 @@ namespace :openid_federation do
502
502
  )
503
503
 
504
504
  if result[:errors].any?
505
- puts "❌ Errors occurred:"
505
+ puts "Error: Errors occurred:"
506
506
  result[:errors].each { |error| puts " - #{error}" }
507
507
  exit 1
508
508
  end
509
509
 
510
- puts "✅ CSRF token extracted: #{result[:csrf_token][0..20]}..." if result[:csrf_token]
511
- puts "✅ Cookies received: #{result[:cookies].length} cookie(s)"
510
+ puts "OK: CSRF token extracted: #{result[:csrf_token][0..20]}..." if result[:csrf_token]
511
+ puts "OK: Cookies received: #{result[:cookies].length} cookie(s)"
512
512
  puts
513
- puts "✅ Authorization URL received"
513
+ puts "OK: Authorization URL received"
514
514
  puts
515
- puts "🔗 Authorization URL:"
515
+ puts "Authorization URL:"
516
516
  puts result[:authorization_url]
517
517
  puts
518
- puts "📋 Instructions:"
518
+ puts "Instructions:"
519
519
  result[:instructions].each { |instruction| puts " #{instruction}" }
520
520
  puts
521
521
 
522
522
  # Step 2: Get callback URL from user
523
523
  puts "=" * 80
524
- puts "📥 Step 2: Waiting for Callback URL"
524
+ puts "Step 2: Waiting for Callback URL"
525
525
  puts "-" * 80
526
526
  puts
527
527
  print "Paste the callback URL here (or press Enter to skip to manual code entry): "
@@ -533,7 +533,7 @@ namespace :openid_federation do
533
533
  auth_code = $stdin.gets.chomp
534
534
 
535
535
  if auth_code.empty?
536
- puts "❌ No authorization code provided"
536
+ puts "Error: No authorization code provided"
537
537
  exit 1
538
538
  end
539
539
 
@@ -544,7 +544,7 @@ namespace :openid_federation do
544
544
  # Step 3: Process callback and validate
545
545
  puts
546
546
  puts "=" * 80
547
- puts "🔄 Step 3: Processing Callback and Validating"
547
+ puts "Step 3: Processing Callback and Validating"
548
548
  puts "-" * 80
549
549
  puts
550
550
 
@@ -562,16 +562,16 @@ namespace :openid_federation do
562
562
  )
563
563
 
564
564
  if callback_result[:errors].any?
565
- puts "❌ Errors occurred:"
565
+ puts "Error: Errors occurred:"
566
566
  callback_result[:errors].each { |error| puts " - #{error}" }
567
567
  exit 1
568
568
  end
569
569
 
570
- puts "✅ Authorization code extracted"
571
- puts "✅ Strategy initialized"
572
- puts "✅ Tokens received"
570
+ puts "OK: Authorization code extracted"
571
+ puts "OK: Strategy initialized"
572
+ puts "OK: Tokens received"
573
573
  puts
574
- puts "📋 Token Information:"
574
+ puts "Token Information:"
575
575
  callback_result[:token_info].each do |key, value|
576
576
  if value
577
577
  label = key.to_s.split("_").map(&:capitalize).join(" ")
@@ -582,14 +582,14 @@ namespace :openid_federation do
582
582
 
583
583
  # Step 4: ID Token validation
584
584
  puts "=" * 80
585
- puts "🔐 Step 4: ID Token Validation"
585
+ puts "Step 4: ID Token Validation"
586
586
  puts "-" * 80
587
587
  puts
588
588
 
589
589
  if callback_result[:id_token_valid]
590
- puts "✅ ID token decrypted and validated"
590
+ puts "OK: ID token decrypted and validated"
591
591
  puts
592
- puts "📋 ID Token Claims:"
592
+ puts "ID Token Claims:"
593
593
  callback_result[:id_token_claims].each do |key, value|
594
594
  if value
595
595
  if [:exp, :iat, :auth_time].include?(key)
@@ -605,20 +605,20 @@ namespace :openid_federation do
605
605
  end
606
606
  end
607
607
  puts
608
- puts "✅ All required claims present"
608
+ puts "OK: All required claims present"
609
609
  else
610
- puts "❌ ID token validation failed"
610
+ puts "Error: ID token validation failed"
611
611
  end
612
612
  puts
613
613
 
614
614
  # Step 5: OpenID Federation Compliance
615
615
  puts "=" * 80
616
- puts "✅ Step 5: OpenID Federation Compliance Check"
616
+ puts "OK: Step 5: OpenID Federation Compliance Check"
617
617
  puts "-" * 80
618
618
  puts
619
619
 
620
620
  callback_result[:compliance_checks].each do |check_name, check_data|
621
- status_icon = check_data[:verified] ? "✅" : "❌"
621
+ status_icon = check_data[:verified] ? "OK:" : "Error:"
622
622
  puts "#{status_icon} #{check_name}"
623
623
  puts " Status: #{check_data[:status]}"
624
624
  puts " Description: #{check_data[:description]}"
@@ -628,15 +628,15 @@ namespace :openid_federation do
628
628
  all_verified = callback_result[:all_compliance_verified]
629
629
 
630
630
  if all_verified
631
- puts "✅ All OpenID Federation requirements verified"
631
+ puts "OK: All OpenID Federation requirements verified"
632
632
  else
633
- puts "⚠️ Some requirements not verified"
633
+ puts "Warning: Some requirements not verified"
634
634
  end
635
635
  puts
636
636
 
637
637
  # Step 6: Summary
638
638
  puts "=" * 80
639
- puts "📊 Test Summary"
639
+ puts "Test Summary"
640
640
  puts "=" * 80
641
641
  puts
642
642
  puts "Provider ACR: #{provider_acr || "Default"}"
@@ -653,19 +653,19 @@ namespace :openid_federation do
653
653
  puts "Authentication Context (acr): #{callback_result[:id_token_claims][:acr]}"
654
654
  end
655
655
  puts
656
- puts "OpenID Federation Compliance: #{all_verified ? "✅ PASS" : "❌ FAIL"}"
656
+ puts "OpenID Federation Compliance: #{all_verified ? "PASS" : "FAIL"}"
657
657
  puts
658
658
  puts "=" * 80
659
659
 
660
660
  if all_verified
661
- puts "✅ All tests passed! Implementation is compliant."
661
+ puts "OK: All checks passed."
662
662
  exit 0
663
663
  else
664
- puts "⚠️ Some checks failed. Review the output above."
664
+ puts "Warning: Some checks failed. Review the output above."
665
665
  exit 1
666
666
  end
667
667
  rescue => e
668
- puts "❌ Test failed: #{e.message}"
668
+ puts "Error: Test failed: #{e.message}"
669
669
  puts " #{e.class}"
670
670
  puts " #{e.backtrace.first(10).join("\n ")}"
671
671
  exit 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth_openid_federation
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Makarov
@@ -99,14 +99,14 @@ dependencies:
99
99
  requirements:
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
- version: 2.2.0
102
+ version: 2.2.9
103
103
  type: :development
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - ">="
108
108
  - !ruby/object:Gem::Version
109
- version: 2.2.0
109
+ version: 2.2.9
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: prosopite
112
112
  requirement: !ruby/object:Gem::Requirement
@@ -484,13 +484,16 @@ files:
484
484
  - examples/jobs/federation_files_generation_job.rb.example
485
485
  - examples/mock_op_server.rb
486
486
  - examples/mock_rp_server.rb
487
+ - examples/relying_party_key_rotation.rb.example
487
488
  - examples/standalone_multiple_endpoints_example.rb
488
489
  - lib/omniauth_openid_federation.rb
489
490
  - lib/omniauth_openid_federation/access_token.rb
490
491
  - lib/omniauth_openid_federation/cache.rb
491
492
  - lib/omniauth_openid_federation/cache_adapter.rb
493
+ - lib/omniauth_openid_federation/client_keys.rb
492
494
  - lib/omniauth_openid_federation/configuration.rb
493
495
  - lib/omniauth_openid_federation/constants.rb
496
+ - lib/omniauth_openid_federation/controller.rb
494
497
  - lib/omniauth_openid_federation/endpoint_resolver.rb
495
498
  - lib/omniauth_openid_federation/engine.rb
496
499
  - lib/omniauth_openid_federation/entity_statement_reader.rb
@@ -520,12 +523,15 @@ files:
520
523
  - lib/omniauth_openid_federation/jws.rb
521
524
  - lib/omniauth_openid_federation/jwt_response_decoder.rb
522
525
  - lib/omniauth_openid_federation/key_extractor.rb
526
+ - lib/omniauth_openid_federation/key_resolver.rb
523
527
  - lib/omniauth_openid_federation/logger.rb
524
528
  - lib/omniauth_openid_federation/oidc_client.rb
525
529
  - lib/omniauth_openid_federation/rack.rb
526
530
  - lib/omniauth_openid_federation/rack_endpoint.rb
531
+ - lib/omniauth_openid_federation/rails.rb
527
532
  - lib/omniauth_openid_federation/railtie.rb
528
533
  - lib/omniauth_openid_federation/rate_limiter.rb
534
+ - lib/omniauth_openid_federation/relying_party_key_store.rb
529
535
  - lib/omniauth_openid_federation/secure_compare.rb
530
536
  - lib/omniauth_openid_federation/strategy.rb
531
537
  - lib/omniauth_openid_federation/strategy/authorization_request.rb