lib/rails/auth/env.rb in rails-auth-2.1.4 vs lib/rails/auth/env.rb in rails-auth-2.2.0
- old
+ new
@@ -3,17 +3,17 @@
module Rails
module Auth
# Wrapper for Rack environments with Rails::Auth helpers
class Env
# Rack environment key for marking external authorization
- AUTHORIZED_ENV_KEY = "rails-auth.authorized".freeze
+ AUTHORIZED_ENV_KEY = "rails-auth.authorized"
# Rack environment key for storing what allowed the request
- ALLOWED_BY_ENV_KEY = "rails-auth.allowed-by".freeze
+ ALLOWED_BY_ENV_KEY = "rails-auth.allowed-by"
# Rack environment key for all rails-auth credentials
- CREDENTIALS_ENV_KEY = "rails-auth.credentials".freeze
+ CREDENTIALS_ENV_KEY = "rails-auth.credentials"
attr_reader :allowed_by, :credentials
# @param [Hash] :env Rack environment
def initialize(env, credentials: {}, authorized: false, allowed_by: nil)
@@ -42,9 +42,10 @@
#
# @param [String] :allowed_by label of what allowed the request
def allowed_by=(allowed_by)
raise AlreadyAuthorizedError, "already allowed by #{@allowed_by.inspect}" if @allowed_by
raise TypeError, "expected String for allowed_by, got #{allowed_by.class}" unless allowed_by.is_a?(String)
+
@allowed_by = allowed_by
end
# Return a Rack environment
#