discourse-scim/config/initializers/scimitar.rb

17 lines
596 B
Ruby
Raw Normal View History

2024-10-07 10:22:23 +00:00
# frozen_string_literal: true
Rails.application.config.to_prepare do
2024-10-10 08:28:13 +00:00
Scimitar.service_provider_configuration = Scimitar::ServiceProviderConfiguration.new({
# TODO: Add configuration about configured services here
})
2024-10-07 10:22:23 +00:00
Scimitar.engine_configuration = Scimitar::EngineConfiguration.new({
token_authenticator: Proc.new do | token, options |
api_key = ApiKey.active.with_key(token).first
allowed = false
if api_key
allowed = api_key.api_key_scopes.any? { |s| s.resource == "scim" || s.action == "access_scim_endpoints" }
end
allowed
2024-10-07 10:22:23 +00:00
end
})
end