1 class ApiController < ApplicationController
2 skip_before_action :verify_authenticity_token
4 def authorize(realm = "Web Password", errormessage = "Couldn't authenticate you")
5 # make the current_user object from any auth sources we have
8 # handle authenticate pass/fail
10 # no auth, the user does not exist or the password was wrong
11 response.headers["WWW-Authenticate"] = "Basic realm=\"#{realm}\""
12 render :plain => errormessage, :status => :unauthorized
17 def deny_access(_exception)
20 report_error t("oauth.permissions.missing"), :forbidden
24 realm = "Web Password"
25 errormessage = "Couldn't authenticate you"
26 response.headers["WWW-Authenticate"] = "Basic realm=\"#{realm}\""
27 render :plain => errormessage, :status => :unauthorized