Class: OmniauthOpenidFederation::RackEndpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/omniauth_openid_federation/rack_endpoint.rb

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Array

Rack call interface

Parameters:

  • env (Hash)

    Rack environment

Returns:

  • (Array)
    status, headers, body

    Rack response



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/omniauth_openid_federation/rack_endpoint.rb', line 40

def call(env)
  request = Rack::Request.new(env)
  path = request.path_info

  case path
  when "/openid-federation"
    handle_entity_statement
  when "/openid-federation/fetch"
    handle_fetch(request)
  when "/jwks.json"
    handle_jwks
  when "/signed-jwks.json"
    handle_signed_jwks
  else
    not_found
  end
rescue OmniauthOpenidFederation::ConfigurationError => e
  OmniauthOpenidFederation::Logger.error("[RackEndpoint] Configuration error: #{e.message}")
  error_response(503, "Federation endpoint not configured")
rescue OmniauthOpenidFederation::SignatureError => e
  OmniauthOpenidFederation::Logger.error("[RackEndpoint] Signature error: #{e.message}")
  error_response(500, "Internal server error")
rescue => e
  OmniauthOpenidFederation::Logger.error("[RackEndpoint] Error: #{e.class} - #{e.message}")
  error_response(500, "Internal server error")
end