[openstreetmap/openstreetmap-website] Add support for OAuth 2 (#3177)

Tom Hughes notifications at github.com
Wed Apr 14 21:52:02 UTC 2021


@tomhughes commented on this pull request.



> +
+    create_table :oauth_access_grants do |t|
+      t.references :resource_owner, :null => false, :type => :bigint
+      t.references :application, :null => false
+      t.string :token, :null => false
+      t.integer :expires_in, :null => false
+      t.text :redirect_uri, :null => false
+      t.datetime :created_at, :null => false
+      t.datetime :revoked_at
+      t.string :scopes, :null => false, :default => ""
+      t.column :code_challenge, :string, :null => true
+      t.column :code_challenge_method, :string, :null => true
+    end
+
+    add_index :oauth_access_grants, :token, :unique => true
+    add_foreign_key :oauth_access_grants, :users, :column => :resource_owner_id, :validate => false

Well it's a new table so there's nothing to validate - new records will still have to obey the constraint.

It's true that the database won't assume it's valid for all records but I'm not sure when that would matter.

I'm not really sure where that came from... It doesn't look like it came from doorkeeper's generator so I guess I added it for some reason, likely to shut safety_assured up because it didn't realise that the table was empty so complained that validation would be blocking.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3177#discussion_r613610427
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20210414/fdc8ab5e/attachment-0001.htm>


More information about the rails-dev mailing list