forked from openstreetmap/openstreetmap-website
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/pull/4226'
- Loading branch information
Showing
15 changed files
with
289 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# frozen_string_literal: true | ||
|
||
Doorkeeper::OpenidConnect.configure do | ||
issuer do |_resource_owner, _application| | ||
"#{Settings.server_protocol}://#{Settings.server_url}" | ||
end | ||
|
||
signing_key Settings.doorkeeper_signing_key | ||
|
||
subject_types_supported [:public] | ||
|
||
resource_owner_from_access_token do |access_token| | ||
User.find_by(:id => access_token.resource_owner_id) | ||
end | ||
|
||
auth_time_from_resource_owner do |resource_owner| | ||
# empty block necessary as a workaround to missing configuration | ||
# when no auth_time claim is provided | ||
end | ||
|
||
subject do |resource_owner, _application| | ||
resource_owner.id | ||
end | ||
|
||
protocol do | ||
Settings.server_protocol.to_sym | ||
end | ||
|
||
claims do | ||
claim :preferred_username, :scope => :openid do |resource_owner, _scopes, _access_token| | ||
resource_owner.display_name | ||
end | ||
|
||
claim :email, :scope => :read_email, :response => [:id_token, :user_info] do |resource_owner, _scopes, _access_token| | ||
resource_owner.email | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
db/migrate/20230830115219_create_doorkeeper_openid_connect_tables.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class CreateDoorkeeperOpenidConnectTables < ActiveRecord::Migration[7.0] | ||
def change | ||
create_table :oauth_openid_requests do |t| | ||
t.references :access_grant, :null => false, :index => true | ||
t.string :nonce, :null => false | ||
end | ||
|
||
# Avoid validating foreign keys doe to possible deadlock | ||
# create a separate migration instead, as suggested by db:migrate | ||
|
||
add_foreign_key( | ||
:oauth_openid_requests, | ||
:oauth_access_grants, | ||
:column => :access_grant_id, | ||
:on_delete => :cascade, :validate => false | ||
) | ||
end | ||
end |
6 changes: 6 additions & 0 deletions
6
db/migrate/20230830115220_validate_create_doorkeeper_openid_connect_tables.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class ValidateCreateDoorkeeperOpenidConnectTables < ActiveRecord::Migration[7.0] | ||
# Validate foreign key created by CreateDoorkeeperOpenidConnectTables | ||
def change | ||
validate_foreign_key :oauth_openid_requests, :oauth_access_grants | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.