mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
FEATURE: Delegated authentication via user api keys (#7272)
This commit is contained in:
parent
25feb287b8
commit
fdf4145d4b
13 changed files with 342 additions and 23 deletions
|
@ -5,6 +5,7 @@ class UserApiKey < ActiveRecord::Base
|
|||
write: [:get, :post, :patch, :put, :delete],
|
||||
message_bus: [[:post, 'message_bus']],
|
||||
push: nil,
|
||||
one_time_password: nil,
|
||||
notifications: [[:post, 'message_bus'], [:get, 'notifications#index'], [:put, 'notifications#mark_read']],
|
||||
session_info: [
|
||||
[:get, 'session#current'],
|
||||
|
@ -63,6 +64,11 @@ class UserApiKey < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def self.invalid_auth_redirect?(auth_redirect)
|
||||
return SiteSetting.allowed_user_api_auth_redirects
|
||||
.split('|')
|
||||
.none? { |u| WildcardUrlChecker.check_url(u, auth_redirect) }
|
||||
end
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue