1
0
Fork 0
forked from OpenNeo/impress

Add OmniAuth plugin to AuthUser

This is setting us up for NeoPass, but first we're just gonna try stuff
with the "developer" strategy that's built in for testing, rather than
using the NeoPass dev server!
This commit is contained in:
Emi Matchu 2024-03-13 13:10:59 -07:00
parent 58e6b46b42
commit 08b1b9e83b
10 changed files with 26 additions and 3 deletions

View file

@ -25,6 +25,8 @@ gem 'turbo-rails', '~> 2.0'
# For authentication.
gem 'devise', '~> 4.9', '>= 4.9.2'
gem 'devise-encryptable', '~> 0.2.0'
gem 'omniauth', '~> 2.1'
gem 'omniauth-rails_csrf_protection', '~> 1.0'
# For pagination UI.
gem 'will_paginate', '~> 4.0'

View file

@ -164,6 +164,7 @@ GEM
temple (>= 0.8.2)
thor
tilt
hashie (5.0.0)
http_accept_language (2.1.1)
httparty (0.21.0)
mini_mime (>= 1.0.0)
@ -214,6 +215,13 @@ GEM
nokogiri (1.16.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
omniauth (2.1.2)
hashie (>= 3.4.6)
rack (>= 2.2.3)
rack-protection
omniauth-rails_csrf_protection (1.0.1)
actionpack (>= 4.2)
omniauth (~> 2.0)
openssl (3.2.0)
orm_adapter (0.5.0)
parallel (1.24.0)
@ -239,6 +247,9 @@ GEM
rack (>= 1.0, < 4)
rack-mini-profiler (3.3.1)
rack (>= 1.2.0)
rack-protection (4.0.0)
base64 (>= 0.1.0)
rack (>= 3.0.0, < 4)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
@ -382,6 +393,8 @@ DEPENDENCIES
memory_profiler (~> 1.0)
mysql2 (~> 0.5.5)
nokogiri (~> 1.15, >= 1.15.3)
omniauth (~> 2.1)
omniauth-rails_csrf_protection (~> 1.0)
parallel (~> 1.23)
rack-attack (~> 6.7)
rack-mini-profiler (~> 3.1)

View file

@ -2,7 +2,7 @@ class AuthUser < AuthRecord
self.table_name = 'users'
devise :database_authenticatable, :encryptable, :registerable, :validatable,
:rememberable, :trackable, :recoverable
:rememberable, :trackable, :recoverable, omniauthable: [:developer]
validates :name, presence: true, uniqueness: {case_sensitive: false},
length: {maximum: 20}

View file

@ -273,7 +273,7 @@ Devise.setup do |config|
# ==> OmniAuth
# Add a new OmniAuth provider. Check the wiki for more information on setting
# up on your models and hooks.
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
config.omniauth :developer
# ==> Warden configuration
# If you want to use other strategies, that are not supported by Devise, or

View file

@ -0,0 +1,6 @@
class AddOmniauthFieldsToUsers < ActiveRecord::Migration[7.1]
def change
add_column :users, :provider, :string
add_column :users, :uid, :string
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.1].define(version: 2023_08_07_005748) do
ActiveRecord::Schema[7.1].define(version: 2024_03_13_200849) do
create_table "users", id: { type: :integer, unsigned: true }, charset: "utf8mb3", collation: "utf8mb3_general_ci", force: :cascade do |t|
t.string "name", limit: 20, null: false
t.string "encrypted_password", limit: 64, null: false
@ -29,6 +29,8 @@ ActiveRecord::Schema[7.1].define(version: 2023_08_07_005748) do
t.datetime "updated_at", precision: nil
t.datetime "reset_password_sent_at", precision: nil
t.datetime "remember_created_at"
t.string "provider"
t.string "uid"
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true

BIN
vendor/cache/hashie-5.0.0.gem vendored Normal file

Binary file not shown.

BIN
vendor/cache/omniauth-2.1.2.gem vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
vendor/cache/rack-protection-4.0.0.gem vendored Normal file

Binary file not shown.