Files
rickyandClaude Opus 5.5 bff6a05173 Remove orphaned code and unused Solid Cable; simplify compliance status
- Delete methods nothing calls: BackupRun.last_good, EntrySignature#short_id,
  Sso#issuer_origin, InspectionType#effect_label and #latest_record_for,
  ApplicationHelper#airworthiness_dot, Airworthiness::Status#can_fly? and
  FlightStats#shortest_flight (tests now check red? / longest_flight)
- Routes: sessions and passwords limited to the actions that exist
- Theme toggle: drop the unused button target
- Action Cable was never used (no broadcasts or streams): async adapter in
  production, solid_cable gem, cable database and app/channels removed
- Empty system test setup removed with capybara and selenium-webdriver
- Compliance: one due_result helper for overdue / due soon; inspections use
  next_due for the date, as ADs do
- applicable_to moved into SharedRecordHistory (was identical in ADs and
  inspection types)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 21:04:41 -05:00

37 lines
1.7 KiB
Ruby

# Single sign-on through an OpenID Connect provider (Authentik, Keycloak,
# Google…), configured with environment variables:
#
# OIDC_ISSUER issuer URL, e.g. https://auth.example.com/application/o/sam/
# OIDC_CLIENT_ID client ID
# OIDC_CLIENT_SECRET client secret
# OIDC_PROVIDER_NAME button label (default "SSO")
# OIDC_AUTO_CREATE_USERS "true" to create an account for anyone the
# provider lets through (they start with no aircraft)
# OIDC_TRUST_EMAIL "true" to link existing accounts by email even when
# the provider doesn't mark the email verified. Only
# for providers where users can't change their email.
# OIDC_ADMIN_GROUP members of this group are admins, others aren't
# (synced at each sign-in; needs a "groups" claim)
# PASSWORD_LOGIN "false" to turn off email/password sign-in once SSO works
# APP_URL public base URL (default https://APP_HOST)
module Sso
PROVIDER = :oidc
module_function
def enabled? = ENV["OIDC_ISSUER"].present? && ENV["OIDC_CLIENT_ID"].present?
def label = ENV["OIDC_PROVIDER_NAME"].presence || "SSO"
def auto_create_users? = ENV["OIDC_AUTO_CREATE_USERS"] == "true"
def trust_email? = ENV["OIDC_TRUST_EMAIL"] == "true"
def admin_group = ENV["OIDC_ADMIN_GROUP"].presence
# Password sign-in stays on unless SSO is set up and it's switched off, so
# a broken SSO setup can't lock everyone out.
def password_login? = !enabled? || ENV["PASSWORD_LOGIN"] != "false"
def app_url
ENV["APP_URL"].presence&.chomp("/") ||
"#{ENV.fetch('FORCE_SSL', 'true') == 'true' ? 'https' : 'http'}://#{ENV.fetch('APP_HOST', 'localhost:3000')}"
end
end