Class: Identizer::App
- Inherits:
-
Object
- Object
- Identizer::App
- Includes:
- Responses
- Defined in:
- lib/identizer/app.rb
Overview
The Rack application. Mount it in a test harness or run it standalone via Identizer::Server. It serves three surfaces: the web admin (Overview / Directory / Settings / Docs), the runtime IdP endpoints, and the AWS Cognito management API (requests carrying x-amz-target).
Defined Under Namespace
Classes: Context
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(config = Identizer.configuration) ⇒ App
constructor
A new instance of App.
Methods included from Responses
#amz_json, #escape_html, #html, #json, #no_content, #not_found, #notice_page, #redirect, #xml
Constructor Details
#initialize(config = Identizer.configuration) ⇒ App
Returns a new instance of App.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/identizer/app.rb', line 13 def initialize(config = Identizer.configuration) @config = config context = Context.new(config, config.identity_store, TokenMinter.new(config), GrantStore.new, GrantStore.new, GrantStore.new, Renderer.new) @overview = Handlers::Overview.new(context) @directory = Handlers::Directory.new(context) @settings = Handlers::Settings.new(context) @docs = Handlers::Docs.new(context) @login = Handlers::Login.new(context) @cognito = Handlers::Cognito.new(context) @auth0 = Handlers::Auth0.new(context) @auth0_management = Handlers::Auth0Management.new(context) @oidc = Handlers::Oidc.new(context) @saml = Handlers::Saml.new(context) end |
Instance Method Details
#call(env) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/identizer/app.rb', line 29 def call(env) request = Rack::Request.new(env) target = env["HTTP_X_AMZ_TARGET"] if target @cognito.management_api(target, request) else route(request) end rescue StandardError => e # Surface the failure to the console (this is a local dev tool) instead of # silently swallowing it; still return a JSON 500 to the client. env["rack.errors"]&.puts("[identizer] #{e.class}: #{e.}\n #{e.backtrace&.first(8)&.join("\n ")}") json(500, { error: e. }) end |