Sha256: 74f0f9eaa8ca2996749bd46e71b9327b6e38913ed6057a69add6632d2066fcbb

Contents?: true

Size: 592 Bytes

Versions: 10

Compression:

Stored size: 592 Bytes

Contents

require 'casino/authenticator'

# The static authenticator is just a simple example.
# Never ever us this authenticator in a productive environment!
class CASino::StaticAuthenticator < CASino::Authenticator

  # @param [Hash] options
  def initialize(options)
    @users = options[:users] || {}
  end

  def validate(username, password)
    username = :"#{username}"
    if @users.include?(username) && @users[username][:password] == password
      {
        username: "#{username}",
        extra_attributes: @users[username].except(:password)
      }
    else
      false
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
casino-2.0.7 app/authenticators/casino/static_authenticator.rb
casino-3.0.0.pre.2 app/authenticators/casino/static_authenticator.rb
casino-3.0.0.pre.1 app/authenticators/casino/static_authenticator.rb
casino-2.0.6 app/authenticators/casino/static_authenticator.rb
casino-2.0.5 app/authenticators/casino/static_authenticator.rb
casino-2.0.4 app/authenticators/casino/static_authenticator.rb
casino-2.0.3 app/authenticators/casino/static_authenticator.rb
casino-2.0.2 app/authenticators/casino/static_authenticator.rb
casino-2.0.1 app/authenticators/casino/static_authenticator.rb
casino-2.0.0 app/authenticators/casino/static_authenticator.rb