module Rails::Auth
Modular resource-based authentication and authorization for Rails/Rack
Modular resource-based authentication and authorization for Rails/Rack
Pluggable authentication and authorization for Rack/Rails
Constants
- AlreadyAuthorizedError
Internal errors involving authorizing things that are already authorized
- Error
Base class of all
Rails::Auth
errors- NotAuthorizedError
Unauthorized!
- ParseError
- VERSION
Public Instance Methods
Add a credential to the Rack environment
@param [Hash] :rack_env Rack environment @param [String] :type credential type to add to the environment @param [Object] :credential object to add to the environment
# File lib/rails/auth/helpers.rb, line 60 def add_credential(rack_env, type, credential) Env.new(rack_env).tap do |env| env.credentials[type] = credential end.to_rack end
Read what authorized the request
@param [Hash] :rack_env Rack environment
@return [String, nil] what authorized the request
# File lib/rails/auth/helpers.rb, line 42 def allowed_by(rack_env) Env.new(rack_env).allowed_by end
Obtain credentials from a Rack environment
@param [Hash] :rack_env Rack environment
# File lib/rails/auth/helpers.rb, line 50 def credentials(rack_env) Credentials.from_rack_env(rack_env) end
Mark what authorized the request in the Rack environment
@param [Hash] :rack_env Rack environment @param [String] :allowed_by what allowed this request
# File lib/rails/auth/helpers.rb, line 31 def set_allowed_by(rack_env, allowed_by) Env.new(rack_env).tap do |env| env.allowed_by = allowed_by end.to_rack end