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({
|
2024-10-24 08:19:55 +00:00
|
|
|
authenticationSchemes: [
|
|
|
|
Scimitar::AuthenticationScheme.bearer
|
|
|
|
]
|
2024-10-10 08:28:13 +00:00
|
|
|
})
|
2024-10-07 10:22:23 +00:00
|
|
|
Scimitar.engine_configuration = Scimitar::EngineConfiguration.new({
|
|
|
|
token_authenticator: Proc.new do | token, options |
|
2024-10-08 09:39:50 +00:00
|
|
|
api_key = ApiKey.active.with_key(token).first
|
|
|
|
allowed = false
|
|
|
|
if api_key
|
2024-12-05 10:32:22 +00:00
|
|
|
allowed = true
|
2024-10-08 09:39:50 +00:00
|
|
|
end
|
|
|
|
allowed
|
2024-10-07 10:22:23 +00:00
|
|
|
end
|
|
|
|
})
|
|
|
|
end
|