Module: LcpRuby::OidcButtonHelper

Defined in:
app/helpers/lcp_ruby/oidc_button_helper.rb

Overview

Renders the inline SVG glyph for an OIDC provider button. Names match the ‘icon:` field in `auth.yml` (Provider#icon). Unknown names render no glyph (caller’s text label still shows).

Provider logos are simplified, brand-recognisable marks rendered as inline SVG so the login view ships without an icon font / sprite sheet dependency. Sizes are normalised to a 20×20 box.

Constant Summary collapse

PROVIDER_ICONS =
{
  "microsoft" => <<~SVG.html_safe,
  "google" => <<~SVG.html_safe,
  "okta" => <<~SVG.html_safe,
  "keycloak" => <<~SVG.html_safe,
  "key" => <<~SVG.html_safe
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
      <circle cx="8" cy="15" r="4"/>
      <path d="M21 2l-9 9"/>
      <path d="M16 7l3 3"/>
      <path d="M19 5l2 2"/>
    </svg>
  SVG
}.freeze

Instance Method Summary collapse

Instance Method Details

#oidc_provider_icon(name) ⇒ Object

Returns the inline SVG glyph for a provider icon name, or nil when no built-in mark is registered. Caller is expected to render the text label regardless — the icon is purely decorative (‘aria-hidden`).



54
55
56
57
# File 'app/helpers/lcp_ruby/oidc_button_helper.rb', line 54

def oidc_provider_icon(name)
  return nil if name.blank?
  PROVIDER_ICONS[name.to_s]
end