Module: RazorRisk::Cassini::HeaderFunctions

Included in:
Sinatra::Helpers::CheckAuthHelper
Defined in:
lib/razor_risk/cassini/header_functions.rb

Instance Method Summary collapse

Instance Method Details

#make_WWW_auth_header(auth_by) ⇒ Object

Returns A hash, which will be empty when the scheme is not.

Returns:

  • A hash, which will be empty when the scheme is not



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/razor_risk/cassini/header_functions.rb', line 34

def make_WWW_auth_header auth_by

    case auth_by
    when :basic

        { 'WWW-Authenticate' => 'Basic' + ' realm="system", error="missing_token", error_description="The Authorization header was not supplied, or was empty"' }
    when :authorisation_only

        { 'WWW-Authenticate' => Constants::SCHEME_AUTH_ONLY + ' realm="system", error="missing_token", error_description="The Authorization header was not supplied, or was empty"' }
    when :jwt

        { 'WWW-Authenticate' => 'Bearer' + ' realm="system", error="missing_token", error_description="The Authorization header was not supplied, or was empty"' }
    else

        {}
    end
end