Create users table and OmniAuth integration #32
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Feature
Lineage
Follow-up from spike #16 (
docs/auth.md— Schema Design + Routes + Controller sections). Depends on #31 (Keycloak provisioning).Repo
ldraney/palinksUser Story
As a visitor
I want to log in via Keycloak
So that I can access member-tier links and features
Context
The auth flow: visitor clicks login -> redirected to Keycloak -> OIDC callback -> user found-or-created in local DB -> session set. The
userstable storeskeycloak_sub(stable OIDC subject ID), email, role (refreshed from token on each login), and preferences JSONB (for per-user feature flag overrides). The spike doc has complete code sketches for OmniAuth initializer, SessionsController, and ApplicationController helpers.File Targets
Gemfile— addomniauth-keycloak,omniauth-rails_csrf_protectiondb/migrate/xxx_create_users.rb— users table migrationapp/models/user.rb— new modelconfig/initializers/omniauth.rb— Keycloak OIDC strategyconfig/routes.rb— add OmniAuth callback routes, logoutapp/controllers/sessions_controller.rb— new controller (create, destroy, failure)app/controllers/application_controller.rb— add current_user, logged_in?, current_role helpersapp/views/— add login/logout button to layoutFeature Flag
None — core auth infrastructure, not a toggleable feature.
Acceptance Criteria
current_userandcurrent_rolehelpers work in controllers and viewsTest Expectations
bundle exec rails testConstraints
keycloak_subis the stable identifier (not email)Checklist
Related
project-palinks— project pagedocs/auth.md— full design spec