Class: BetterAuth::Middleware::OriginCheck
- Inherits:
-
Object
- Object
- BetterAuth::Middleware::OriginCheck
- Defined in:
- lib/better_auth/middleware/origin_check.rb
Constant Summary collapse
- DEPRECATION_WARNING =
"[Deprecation] disableOriginCheck: true currently also disables CSRF checks. In a future version, disableOriginCheck will ONLY disable URL validation. To keep CSRF disabled, add disableCSRFCheck: true to your config."
Instance Method Summary collapse
- #call(endpoint_context) ⇒ Object
-
#initialize ⇒ OriginCheck
constructor
A new instance of OriginCheck.
Constructor Details
#initialize ⇒ OriginCheck
Returns a new instance of OriginCheck.
8 9 10 |
# File 'lib/better_auth/middleware/origin_check.rb', line 8 def initialize @warned_backward_compat = false end |
Instance Method Details
#call(endpoint_context) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/better_auth/middleware/origin_check.rb', line 12 def call(endpoint_context) return if %w[GET OPTIONS HEAD].include?(endpoint_context.method) validate_origin(endpoint_context) (endpoint_context) return if skip_origin_check?(endpoint_context) validate_callback_urls(endpoint_context) nil rescue APIError => error Endpoint::Result.new(response: error.to_h, status: error.status_code, headers: error.headers).to_rack_response end |