source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/session_test/foundation_test.rb
Ruby
mit
4,346
master
636
# frozen_string_literal: true require "test_helper" # We forbid the use of AC::Parameters, and we have a test to that effect, but we # do not want a development dependency on `actionpack`, so we define it here. module ActionController class Parameters; end end module SessionTest class FoundationTest < ActiveSupp...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/session_test/timeout_test.rb
Ruby
mit
4,346
master
2,450
# frozen_string_literal: true require "test_helper" module SessionTest module TimeoutTest class ConfigTest < ActiveSupport::TestCase def test_logout_on_timeout UserSession.logout_on_timeout = true assert UserSession.logout_on_timeout UserSession.logout_on_timeout false ref...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/session_test/session_test.rb
Ruby
mit
4,346
master
3,126
# frozen_string_literal: true require "test_helper" module SessionTest module SessionTest class ConfigTest < ActiveSupport::TestCase def test_session_key UserSession.session_key = "my_session_key" assert_equal "my_session_key", UserSession.session_key UserSession.session_key "user...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/session_test/klass_test.rb
Ruby
mit
4,346
master
1,113
# frozen_string_literal: true require "test_helper" module SessionTest module KlassTest class ConfigTest < ActiveSupport::TestCase def test_authenticate_with UserSession.authenticate_with = Employee assert_equal "Employee", UserSession.klass_name assert_equal Employee, UserSession....
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/session_test/unauthorized_record_test.rb
Ruby
mit
4,346
master
395
# frozen_string_literal: true require "test_helper" module SessionTest class UnauthorizedRecordTest < ActiveSupport::TestCase def test_credentials ben = users(:ben) session = UserSession.new session.credentials = [ben] assert_equal ben, session.unauthorized_record assert_equal({ un...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/session_test/persistence_test.rb
Ruby
mit
4,346
master
1,390
# frozen_string_literal: true require "test_helper" require "authlogic/controller_adapters/rails_adapter" module SessionTest class PersistenceTest < ActiveSupport::TestCase def test_find aaron = users(:aaron) refute UserSession.find UserSession.allow_http_basic_auth = true http_basic_aut...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/session_test/perishability_test.rb
Ruby
mit
4,346
master
419
# frozen_string_literal: true require "test_helper" module SessionTest class PerishabilityTest < ActiveSupport::TestCase def test_after_save ben = users(:ben) old_perishable_token = ben.perishable_token UserSession.create(ben) assert_not_equal old_perishable_token, ben.perishable_token ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/session_test/scopes_test.rb
Ruby
mit
4,346
master
2,031
# frozen_string_literal: true require "test_helper" module SessionTest class ScopesTest < ActiveSupport::TestCase def test_scope_method assert_nil Authlogic::Session::Base.scope thread1 = Thread.new do scope = { id: :scope1 } Authlogic::Session::Base.send(:scope=, scope) ass...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/session_test/id_test.rb
Ruby
mit
4,346
master
385
# frozen_string_literal: true require "test_helper" module SessionTest class IdTest < ActiveSupport::TestCase def test_credentials session = UserSession.new session.credentials = [:my_id] assert_equal :my_id, session.id end def test_id session = UserSession.new session.id ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/session_test/active_record_trickery_test.rb
Ruby
mit
4,346
master
2,226
# frozen_string_literal: true require "test_helper" module SessionTest module ActiveRecordTrickeryTest class ClassMethodsTest < ActiveSupport::TestCase # If test_human_name is executed after test_i18n_of_human_name the test will fail. i_suck_and_my_tests_are_order_dependent! def test_human_at...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/session_test/brute_force_protection_test.rb
Ruby
mit
4,346
master
3,935
# frozen_string_literal: true require "test_helper" module SessionTest module BruteForceProtectionTest class ConfigTest < ActiveSupport::TestCase def test_consecutive_failed_logins_limit UserSession.consecutive_failed_logins_limit = 10 assert_equal 10, UserSession.consecutive_failed_logins...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/session_test/validation_test.rb
Ruby
mit
4,346
master
586
# frozen_string_literal: true require "test_helper" module SessionTest class ValidationTest < ActiveSupport::TestCase def test_errors session = UserSession.new assert_kind_of ::ActiveModel::Errors, session.errors end def test_valid session = UserSession.new refute session.valid?...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/session_test/http_auth_test.rb
Ruby
mit
4,346
master
2,066
# frozen_string_literal: true require "test_helper" module SessionTest class HttpAuthTest < ActiveSupport::TestCase class ConfigTest < ActiveSupport::TestCase def test_allow_http_basic_auth UserSession.allow_http_basic_auth = false assert_equal false, UserSession.allow_http_basic_auth ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/session_test/callbacks_test.rb
Ruby
mit
4,346
master
1,200
# frozen_string_literal: true require "test_helper" module SessionTest class CallbacksTest < ActiveSupport::TestCase def setup WackyUserSession.reset_callbacks(:persist) end def test_no_callbacks assert_equal [], WackyUserSession._persist_callbacks.map(&:filter) session = WackyUserSes...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/libs/employee.rb
Ruby
mit
4,346
master
229
# frozen_string_literal: true class Employee < ActiveRecord::Base acts_as_authentic do |config| silence_warnings do config.crypto_provider = Authlogic::CryptoProviders::Sha512 end end belongs_to :company end
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/libs/user.rb
Ruby
mit
4,346
master
2,119
# frozen_string_literal: true class User < ActiveRecord::Base EMAIL = / \A [A-Z0-9_.&%+\-']+ # mailbox @ (?:[A-Z0-9\-]+\.)+ # subdomains (?:[A-Z]{2,25}) # TLD \z /ix.freeze LOGIN = /\A[a-zA-Z0-9_][a-zA-Z0-9\.+\-_@ ]+\z/.freeze acts_as_authentic do |c| c.crypto_provider = Aut...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/libs/user_session.rb
Ruby
mit
4,346
master
418
# frozen_string_literal: true class UserSession < Authlogic::Session::Base end class BackOfficeUserSession < Authlogic::Session::Base end class WackyUserSession < Authlogic::Session::Base attr_accessor :counter authenticate_with User def initialize @counter = 0 super end def persist_by_false ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/libs/admin.rb
Ruby
mit
4,346
master
882
# frozen_string_literal: true # This model demonstrates an `after_save` callback. class Admin < ActiveRecord::Base acts_as_authentic do |c| c.crypto_provider = Authlogic::CryptoProviders::SCrypt end validates :password, confirmation: true after_save do # In rails 5.1 `role_changed?` was deprecated in...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/acts_as_authentic_test/single_access_test.rb
Ruby
mit
4,346
master
1,417
# frozen_string_literal: true require "test_helper" module ActsAsAuthenticTest class SingleAccessTest < ActiveSupport::TestCase def test_change_single_access_token_with_password_config refute User.change_single_access_token_with_password refute Employee.change_single_access_token_with_password ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/acts_as_authentic_test/password_test.rb
Ruby
mit
4,346
master
7,095
# frozen_string_literal: true require "test_helper" module ActsAsAuthenticTest class PasswordTest < ActiveSupport::TestCase # If test_human_name is executed after test_i18n_of_human_name the test will fail. i_suck_and_my_tests_are_order_dependent! def test_crypted_password_field_config assert_equ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/acts_as_authentic_test/persistence_token_test.rb
Ruby
mit
4,346
master
1,842
# frozen_string_literal: true require "test_helper" module ActsAsAuthenticTest class PersistenceTokenTest < ActiveSupport::TestCase def test_after_password_set_reset_persistence_token ben = users(:ben) old_persistence_token = ben.persistence_token ben.password = "newpass" assert_not_equa...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/acts_as_authentic_test/base_test.rb
Ruby
mit
4,346
master
928
# frozen_string_literal: true require "test_helper" module ActsAsAuthenticTest class BaseTest < ActiveSupport::TestCase def test_acts_as_authentic assert_nothing_raised do User.acts_as_authentic do end end end def test_acts_as_authentic_with_old_config assert_raise(Arg...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/acts_as_authentic_test/email_test.rb
Ruby
mit
4,346
master
847
# frozen_string_literal: true require "test_helper" module ActsAsAuthenticTest class EmailTest < ActiveSupport::TestCase def test_email_field_config assert_equal :email, User.email_field assert_equal :email, Employee.email_field User.email_field = :nope assert_equal :nope, User.email_fi...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/acts_as_authentic_test/logged_in_status_test.rb
Ruby
mit
4,346
master
2,336
# frozen_string_literal: true require "test_helper" module ActsAsAuthenticTest class LoggedInStatusTest < ActiveSupport::TestCase ERROR_MSG = "Multiple calls to %s should result in different relations" def test_logged_in_timeout_config assert_equal 10.minutes.to_i, User.logged_in_timeout assert...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/acts_as_authentic_test/session_maintenance_test.rb
Ruby
mit
4,346
master
5,439
# frozen_string_literal: true require "test_helper" module ActsAsAuthenticTest class SessionMaintenanceTest < ActiveSupport::TestCase def setup User.log_in_after_create = true User.log_in_after_password_change = true end def test_log_in_after_create_config assert User.log_in_after_cre...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/acts_as_authentic_test/login_test.rb
Ruby
mit
4,346
master
1,342
# frozen_string_literal: true require "test_helper" module ActsAsAuthenticTest # Miscellaneous tests for configuration options related to the `login_field`. class MiscellaneousLoginTest < ActiveSupport::TestCase def test_login_field_config assert_equal :login, User.login_field assert_nil Employee....
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/acts_as_authentic_test/magic_columns_test.rb
Ruby
mit
4,346
master
694
# frozen_string_literal: true require "test_helper" module ActsAsAuthenticTest class MagicColumnsTest < ActiveSupport::TestCase def test_validates_numericality_of_login_count u = User.new u.login_count = -1 refute u.valid? refute u.errors[:login_count].empty? u.login_count = 0 ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/acts_as_authentic_test/perishable_token_test.rb
Ruby
mit
4,346
master
3,473
# frozen_string_literal: true require "test_helper" module ActsAsAuthenticTest class PerishableTokenTest < ActiveSupport::TestCase def test_perishable_token_valid_for_config assert_equal 10.minutes.to_i, User.perishable_token_valid_for assert_equal 10.minutes.to_i, Employee.perishable_token_valid_fo...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/crypto_provider_test/scrypt_test.rb
Ruby
mit
4,346
master
399
# frozen_string_literal: true require "test_helper" module CryptoProviderTest class SCryptTest < ActiveSupport::TestCase def test_encrypt assert Authlogic::CryptoProviders::SCrypt.encrypt("mypass") end def test_matches hash = Authlogic::CryptoProviders::SCrypt.encrypt("mypass") assert...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/crypto_provider_test/sha1_test.rb
Ruby
mit
4,346
master
1,471
# frozen_string_literal: true require "test_helper" module CryptoProviderTest class Sha1Test < ActiveSupport::TestCase def setup @default_stretches = Authlogic::CryptoProviders::Sha1.stretches end def teardown Authlogic::CryptoProviders::Sha1.stretches = @default_stretches end def ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/crypto_provider_test/sha256_test.rb
Ruby
mit
4,346
master
1,559
# frozen_string_literal: true require "test_helper" module CryptoProviderTest class Sha256Test < ActiveSupport::TestCase def setup @default_stretches = Authlogic::CryptoProviders::Sha256.stretches end def teardown Authlogic::CryptoProviders::Sha256.stretches = @default_stretches end ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/crypto_provider_test/md5_test.rb
Ruby
mit
4,346
master
1,439
# frozen_string_literal: true require "test_helper" module CryptoProviderTest class MD5Test < ActiveSupport::TestCase def setup @default_stretches = Authlogic::CryptoProviders::MD5.stretches end def teardown Authlogic::CryptoProviders::MD5.stretches = @default_stretches end def tes...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/crypto_provider_test/sha512_test.rb
Ruby
mit
4,346
master
1,784
# frozen_string_literal: true require "test_helper" module CryptoProviderTest class Sha512Test < ActiveSupport::TestCase def setup @default_stretches = Authlogic::CryptoProviders::Sha512.stretches end def teardown Authlogic::CryptoProviders::Sha512.stretches = @default_stretches end ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/crypto_provider_test/bcrypt_test.rb
Ruby
mit
4,346
master
399
# frozen_string_literal: true require "test_helper" module CryptoProviderTest class BCryptTest < ActiveSupport::TestCase def test_encrypt assert Authlogic::CryptoProviders::BCrypt.encrypt("mypass") end def test_matches hash = Authlogic::CryptoProviders::BCrypt.encrypt("mypass") assert...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/crypto_provider_test/sha256/v2_test.rb
Ruby
mit
4,346
master
1,675
# frozen_string_literal: true require "test_helper" module CryptoProviderTest module SHA256 class V2Test < ActiveSupport::TestCase def setup @default_stretches = Authlogic::CryptoProviders::Sha256::V2.stretches end def teardown Authlogic::CryptoProviders::Sha256::V2.stretches ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/crypto_provider_test/sha512/v2_test.rb
Ruby
mit
4,346
master
1,910
# frozen_string_literal: true require "test_helper" module CryptoProviderTest module SHA512 class V2Test < ActiveSupport::TestCase def setup @default_stretches = Authlogic::CryptoProviders::Sha512::V2.stretches end def teardown Authlogic::CryptoProviders::Sha512::V2.stretches ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/crypto_provider_test/sha1/v2_test.rb
Ruby
mit
4,346
master
1,588
# frozen_string_literal: true require "test_helper" module CryptoProviderTest module VSHA1 class V2Test < ActiveSupport::TestCase def setup @default_stretches = Authlogic::CryptoProviders::Sha1::V2.stretches end def teardown Authlogic::CryptoProviders::Sha1::V2.stretches = @de...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
test/crypto_provider_test/md5/v2_test.rb
Ruby
mit
4,346
master
1,555
# frozen_string_literal: true require "test_helper" module CryptoProviderTest module MD5 class V2Test < ActiveSupport::TestCase def setup @default_stretches = Authlogic::CryptoProviders::MD5::V2.stretches end def teardown Authlogic::CryptoProviders::MD5::V2.stretches = @defaul...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic.rb
Ruby
mit
4,346
master
1,594
# frozen_string_literal: true require_relative "authlogic/errors" require_relative "authlogic/i18n" require_relative "authlogic/random" require_relative "authlogic/config" require_relative "authlogic/controller_adapters/abstract_adapter" require_relative "authlogic/cookie_credentials" require_relative "authlogic/cry...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/config.rb
Ruby
mit
4,346
master
1,469
# frozen_string_literal: true module Authlogic # Mixed into `Authlogic::ActsAsAuthentic::Base` and # `Authlogic::Session::Base`. module Config E_USE_NORMAL_RAILS_VALIDATION = <<~EOS This Authlogic configuration option (%s) is deprecated. Use normal ActiveRecord validation instead. Detailed instru...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/version.rb
Ruby
mit
4,346
master
551
# frozen_string_literal: true # :nodoc: module Authlogic # Returns a `::Gem::Version`, the version number of the authlogic gem. # # It is preferable for a library to provide a `gem_version` method, rather # than a `VERSION` string, because `::Gem::Version` is easier to use in a # comparison. # # We canno...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/cookie_credentials.rb
Ruby
mit
4,346
master
1,629
# frozen_string_literal: true module Authlogic # Represents the credentials *in* the cookie. The value of the cookie. # This is primarily a data object. It doesn't interact with controllers. # It doesn't know about eg. cookie expiration. # # @api private class CookieCredentials # @api private class...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/errors.rb
Ruby
mit
4,346
master
1,404
# frozen_string_literal: true module Authlogic # Parent class of all Authlogic errors. class Error < StandardError end # :nodoc: class InvalidCryptoProvider < Error end # :nodoc: class NilCryptoProvider < InvalidCryptoProvider def message <<~EOS In version 5, Authlogic used SCrypt b...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/test_case.rb
Ruby
mit
4,346
master
8,312
# frozen_string_literal: true require_relative "test_case/rails_request_adapter" require_relative "test_case/mock_api_controller" require_relative "test_case/mock_cookie_jar" require_relative "test_case/mock_controller" require_relative "test_case/mock_logger" require_relative "test_case/mock_request" # :nodoc: modul...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/random.rb
Ruby
mit
4,346
master
452
# frozen_string_literal: true require "securerandom" module Authlogic # Generates random strings using ruby's SecureRandom library. module Random def self.hex_token SecureRandom.hex(64) end # Returns a string in base64url format as defined by RFC-3548 and RFC-4648. # We call this a "friendl...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/crypto_providers.rb
Ruby
mit
4,346
master
3,629
# frozen_string_literal: true module Authlogic # The acts_as_authentic method has a crypto_provider option. This allows you # to use any type of encryption you like. Just create a class with a class # level encrypt and matches? method. See example below. # # === Example # # class MyAwesomeEncryptionMet...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/i18n.rb
Ruby
mit
4,346
master
3,935
# frozen_string_literal: true require_relative "i18n/translator" module Authlogic # This class allows any message in Authlogic to use internationalization. In # earlier versions of Authlogic each message was translated via configuration. # This cluttered up the configuration and cluttered up Authlogic. So all ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/crypto_providers/sha256.rb
Ruby
mit
4,346
master
1,996
# frozen_string_literal: true require "digest/sha2" module Authlogic # The acts_as_authentic method has a crypto_provider option. This allows you # to use any type of encryption you like. Just create a class with a class # level encrypt and matches? method. See example below. # # === Example # # class...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/crypto_providers/sha512.rb
Ruby
mit
4,346
master
1,130
# frozen_string_literal: true require "digest/sha2" module Authlogic module CryptoProviders # SHA-512 does not have any practical known attacks against it. However, # there are better choices. We recommend transitioning to a more secure, # adaptive hashing algorithm, like scrypt. class Sha512 ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/crypto_providers/md5.rb
Ruby
mit
4,346
master
984
# frozen_string_literal: true require "digest/md5" module Authlogic module CryptoProviders # A poor choice. There are known attacks against this algorithm. class MD5 # V2 hashes the digest bytes in repeated stretches instead of hex characters. autoload :V2, File.join(__dir__, "md5", "v2") ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/crypto_providers/bcrypt.rb
Ruby
mit
4,346
master
3,766
# frozen_string_literal: true require "bcrypt" module Authlogic module CryptoProviders # The family of adaptive hash functions (BCrypt, SCrypt, PBKDF2) # is the best choice for password storage today. They have the # three properties of password hashing that are desirable. They # are one-way, unique...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/crypto_providers/sha1.rb
Ruby
mit
4,346
master
1,122
# frozen_string_literal: true require "digest/sha1" module Authlogic module CryptoProviders # A poor choice. There are known attacks against this algorithm. class Sha1 # V2 hashes the digest bytes in repeated stretches instead of hex characters. autoload :V2, File.join(__dir__, "sha1", "v2") ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/crypto_providers/scrypt.rb
Ruby
mit
4,346
master
2,601
# frozen_string_literal: true require "scrypt" module Authlogic module CryptoProviders # SCrypt is the default provider for Authlogic. It is the only # choice in the adaptive hash family that accounts for hardware # based attacks by compensating with memory bound as well as cpu # bound computational...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/crypto_providers/md5/v2.rb
Ruby
mit
4,346
master
923
# frozen_string_literal: true require "digest/md5" module Authlogic module CryptoProviders class MD5 # A poor choice. There are known attacks against this algorithm. class V2 class << self attr_accessor :join_token # The number of times to loop through the encryption. ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/crypto_providers/sha256/v2.rb
Ruby
mit
4,346
master
1,936
# frozen_string_literal: true require "digest/sha2" module Authlogic # The acts_as_authentic method has a crypto_provider option. This allows you # to use any type of encryption you like. Just create a class with a class # level encrypt and matches? method. See example below. # # === Example # # class...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/crypto_providers/sha512/v2.rb
Ruby
mit
4,346
master
1,099
# frozen_string_literal: true require "digest/sha2" module Authlogic module CryptoProviders class Sha512 # SHA-512 does not have any practical known attacks against it. However, # there are better choices. We recommend transitioning to a more secure, # adaptive hashing algorithm, like scrypt. ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/crypto_providers/sha1/v2.rb
Ruby
mit
4,346
master
1,072
# frozen_string_literal: true require "digest/sha1" module Authlogic module CryptoProviders class Sha1 # A poor choice. There are known attacks against this algorithm. class V2 class << self def join_token @join_token ||= "--" end attr_writer :join_t...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/controller_adapters/rails_adapter.rb
Ruby
mit
4,346
master
1,440
# frozen_string_literal: true module Authlogic module ControllerAdapters # Adapts authlogic to work with rails. The point is to close the gap between # what authlogic expects and what the rails controller object provides. # Similar to how ActiveRecord has an adapter for MySQL, PostgreSQL, SQLite, # e...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/controller_adapters/rack_adapter.rb
Ruby
mit
4,346
master
2,002
# frozen_string_literal: true module Authlogic module ControllerAdapters # Adapter for authlogic to make it function as a Rack middleware. # First you'll have write your own Rack adapter where you have to set your cookie domain. # # class YourRackAdapter < Authlogic::ControllerAdapters::RackAdapt...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/controller_adapters/sinatra_adapter.rb
Ruby
mit
4,346
master
1,673
# frozen_string_literal: true # Authlogic bridge for Sinatra module Authlogic module ControllerAdapters module SinatraAdapter # Cookie management functions class Cookies attr_reader :request, :response def initialize(request, response) @request = request @response...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/controller_adapters/abstract_adapter.rb
Ruby
mit
4,346
master
3,368
# frozen_string_literal: true module Authlogic module ControllerAdapters # :nodoc: # Allows you to use Authlogic in any framework you want, not just rails. See # the RailsAdapter for an example of how to adapt Authlogic to work with # your framework. class AbstractAdapter E_COOKIE_DOMAIN_ADAPTE...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/i18n/translator.rb
Ruby
mit
4,346
master
452
# frozen_string_literal: true module Authlogic module I18n # The default translator used by authlogic/i18n.rb class Translator # If the I18n gem is present, calls +I18n.translate+ passing all # arguments, else returns +options[:default]+. def translate(key, options = {}) if defined?...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/session/base.rb
Ruby
mit
4,346
master
79,459
# frozen_string_literal: true require "request_store" module Authlogic module Session module Activation # :nodoc: class NotActivatedError < ::StandardError def initialize super( "You must activate the Authlogic::Session::Base.controller with " \ "a contr...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/session/magic_column/assigns_last_request_at.rb
Ruby
mit
4,346
master
1,421
# frozen_string_literal: true module Authlogic module Session module MagicColumn # Assigns the current time to the `last_request_at` attribute. # # 1. The `last_request_at` column must exist # 2. Assignment can be disabled on a per-controller basis # 3. Assignment will not happen mo...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/test_case/mock_api_controller.rb
Ruby
mit
4,346
master
1,318
# frozen_string_literal: true module Authlogic module TestCase # Basically acts like an API controller but doesn't do anything. # Authlogic can interact with this, do it's thing and then you can look at # the controller object to see if anything changed. class MockAPIController < ControllerAdapters::...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/test_case/mock_request.rb
Ruby
mit
4,346
master
706
# frozen_string_literal: true module Authlogic module TestCase class MockRequest # :nodoc: attr_accessor :controller def initialize(controller) self.controller = controller end def env @env ||= { ControllerAdapters::AbstractAdapter::ENV_SESSION_OPTIONS => {} ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/test_case/mock_logger.rb
Ruby
mit
4,346
master
252
# frozen_string_literal: true module Authlogic module TestCase # Simple class to replace real loggers, so that we can raise any errors being logged. class MockLogger def error(message) raise message end end end end
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/test_case/rails_request_adapter.rb
Ruby
mit
4,346
master
908
# frozen_string_literal: true module Authlogic module TestCase # Adapts authlogic to work with the @request object when testing. This way Authlogic # can set cookies and what not before a request is made, ultimately letting you log in # users in functional tests. class RailsRequestAdapter < Controlle...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/test_case/mock_controller.rb
Ruby
mit
4,346
master
1,272
# frozen_string_literal: true module Authlogic module TestCase # Basically acts like a controller but doesn't do anything. Authlogic can interact # with this, do it's thing and then you can look at the controller object to see if # anything changed. class MockController < ControllerAdapters::Abstract...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/test_case/mock_cookie_jar.rb
Ruby
mit
4,346
master
2,936
# frozen_string_literal: true module Authlogic module TestCase # A mock of `ActionDispatch::Cookies::CookieJar`. # See action_dispatch/middleware/cookies.rb class MockCookieJar < Hash # :nodoc: attr_accessor :set_cookies def [](key) hash = super hash && hash[:value] end...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/acts_as_authentic/login.rb
Ruby
mit
4,346
master
2,248
# frozen_string_literal: true require_relative "queries/case_sensitivity" require_relative "queries/find_with_case" module Authlogic module ActsAsAuthentic # Handles everything related to the login field. module Login def self.included(klass) klass.class_eval do extend Config ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/acts_as_authentic/persistence_token.rb
Ruby
mit
4,346
master
2,361
# frozen_string_literal: true module Authlogic module ActsAsAuthentic # Maintains the persistence token, the token responsible for persisting sessions. This token # gets stored in the session and the cookie. module PersistenceToken def self.included(klass) klass.class_eval do add_...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/acts_as_authentic/perishable_token.rb
Ruby
mit
4,346
master
4,593
# frozen_string_literal: true module Authlogic module ActsAsAuthentic # This provides a handy token that is "perishable", meaning the token is # only good for a certain amount of time. # # This is useful for resetting password, confirming accounts, etc. Typically # during these actions you send t...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/acts_as_authentic/password.rb
Ruby
mit
4,346
master
14,043
# frozen_string_literal: true module Authlogic module ActsAsAuthentic # This module has a lot of neat functionality. It is responsible for encrypting your # password, salting it, and verifying it. It can also help you transition to a new # encryption algorithm. See the Config sub module for configuration...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/acts_as_authentic/base.rb
Ruby
mit
4,346
master
4,432
# frozen_string_literal: true module Authlogic module ActsAsAuthentic # Provides the base functionality for acts_as_authentic module Base def self.included(klass) klass.class_eval do class_attribute :acts_as_authentic_modules self.acts_as_authentic_modules ||= [] e...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/acts_as_authentic/single_access_token.rb
Ruby
mit
4,346
master
3,013
# frozen_string_literal: true module Authlogic module ActsAsAuthentic # This module is responsible for maintaining the single_access token. For # more information the single access token and how to use it, see "Params" # in `Session::Base`. module SingleAccessToken def self.included(klass) ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/acts_as_authentic/magic_columns.rb
Ruby
mit
4,346
master
1,252
# frozen_string_literal: true module Authlogic module ActsAsAuthentic # Magic columns are like ActiveRecord's created_at and updated_at columns. # They are "magically" maintained for you. Authlogic has the same thing, but # these are maintained on the session side. Please see "Magic Columns" in # `Se...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/acts_as_authentic/session_maintenance.rb
Ruby
mit
4,346
master
6,296
# frozen_string_literal: true module Authlogic module ActsAsAuthentic # This is one of my favorite features that I think is pretty cool. It's # things like this that make a library great and let you know you are on the # right track. # # Just to clear up any confusion, Authlogic stores both the r...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/acts_as_authentic/logged_in_status.rb
Ruby
mit
4,346
master
2,585
# frozen_string_literal: true module Authlogic module ActsAsAuthentic # Since web applications are stateless there is not sure fire way to tell if # a user is logged in or not, from the database perspective. The best way to # do this is to provide a "timeout" based on inactivity. So if that user is #...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/acts_as_authentic/email.rb
Ruby
mit
4,346
master
1,043
# frozen_string_literal: true module Authlogic module ActsAsAuthentic # Sometimes models won't have an explicit "login" or "username" field. # Instead they want to use the email field. In this case, authlogic provides # validations to make sure the email submited is actually a valid email. # Don't wo...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/acts_as_authentic/queries/case_sensitivity.rb
Ruby
mit
4,346
master
1,454
# frozen_string_literal: true module Authlogic module ActsAsAuthentic module Queries # @api private class CaseSensitivity E_UNABLE_TO_DETERMINE_SENSITIVITY = <<~EOS Authlogic was unable to determine what case-sensitivity to use when searching for email/login. To specify a ...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
lib/authlogic/acts_as_authentic/queries/find_with_case.rb
Ruby
mit
4,346
master
2,124
# frozen_string_literal: true module Authlogic module ActsAsAuthentic module Queries # The query used by public-API method `find_by_smart_case_login_field`. # # We use the rails methods `case_insensitive_comparison` and # `case_sensitive_comparison`. These methods nicely take into account...
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
gemfiles/rails_7.2.rb
Ruby
mit
4,346
master
216
# frozen_string_literal: true source "https://rubygems.org" gemspec path: ".." gem "activerecord", "~> 7.2.0" gem "activesupport", "~> 7.2.0" gem "mysql2", "~> 0.5.6" gem "pg", "~> 1.5.8" gem "sqlite3", "~> 2.0.0"
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
gemfiles/rails_8.0.rb
Ruby
mit
4,346
master
216
# frozen_string_literal: true source "https://rubygems.org" gemspec path: ".." gem "activerecord", "~> 8.0.0" gem "activesupport", "~> 8.0.0" gem "mysql2", "~> 0.5.6" gem "pg", "~> 1.5.8" gem "sqlite3", "~> 2.1.0"
github
binarylogic/authlogic
https://github.com/binarylogic/authlogic
gemfiles/rails_8.1.rb
Ruby
mit
4,346
master
216
# frozen_string_literal: true source "https://rubygems.org" gemspec path: ".." gem "activerecord", "~> 8.1.0" gem "activesupport", "~> 8.1.0" gem "mysql2", "~> 0.5.6" gem "pg", "~> 1.5.8" gem "sqlite3", "~> 2.1.0"
github
fog/fog
https://github.com/fog/fog
Gemfile
Ruby
mit
4,298
master
238
source "https://rubygems.org" group :development, :test do # This is here because gemspec doesn't support require: false gem "netrc", :require => false gem "octokit", :require => false gem "rspec", :require => false end gemspec
github
fog/fog
https://github.com/fog/fog
fog.gemspec
Ruby
mit
4,298
master
4,747
# coding: utf-8 lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "fog/version" Gem::Specification.new do |s| s.specification_version = 2 if s.respond_to? :specification_version= s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :re...
github
fog/fog
https://github.com/fog/fog
Rakefile
Ruby
mit
4,298
master
5,424
require 'bundler/setup' require 'rake/testtask' require 'date' require 'rubygems' require 'rubygems/package_task' require 'yard' require File.dirname(__FILE__) + '/lib/fog' require "tasks/changelog_task" Fog::Rake::ChangelogTask.new require "tasks/github_release_task" Fog::Rake::GithubReleaseTask.new ###############...
github
fog/fog
https://github.com/fog/fog
spec/spec_helper.rb
Ruby
mit
4,298
master
220
if ENV["COVERAGE"] require "simplecov" SimpleCov.start do add_filter "/spec/" end end require "minitest/autorun" require "minitest/spec" require "minitest/stub_const" $LOAD_PATH.unshift "lib" require "fog"
github
fog/fog
https://github.com/fog/fog
spec/helpers/bin.rb
Ruby
mit
4,298
master
807
module Fog module BinSpec extend Minitest::Spec::DSL it "responds to available?" do assert_respond_to subject, :available? end it "responds to class_for" do assert_respond_to subject, :class_for end it "#class_for raises ArgumentError for unknown services" do assert_raises...
github
fog/fog
https://github.com/fog/fog
spec/fog/support_spec.rb
Ruby
mit
4,298
master
437
require "spec_helper" describe Fog::Support do Fog::Support.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credenti...
github
fog/fog
https://github.com/fog/fog
spec/fog/account_spec.rb
Ruby
mit
4,298
master
437
require "spec_helper" describe Fog::Account do Fog::Account.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credenti...
github
fog/fog
https://github.com/fog/fog
spec/fog/billing_spec.rb
Ruby
mit
4,298
master
437
require "spec_helper" describe Fog::Billing do Fog::Billing.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credenti...
github
fog/fog
https://github.com/fog/fog
spec/fog/bin_spec.rb
Ruby
mit
4,298
master
7,923
require "spec_helper" require "fog/bin" describe Fog do describe "#providers" do it "includes existing providers" do assert_equal "AWS", Fog.providers[:aws] assert_equal "BareMetalCloud", Fog.providers[:baremetalcloud] assert_equal "Brightbox", Fog.providers[:brightbox] assert_equal "Clod...
github
fog/fog
https://github.com/fog/fog
spec/fog/identity_spec.rb
Ruby
mit
4,298
master
440
require "spec_helper" describe Fog::Identity do Fog::Identity.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :creden...
github
fog/fog
https://github.com/fog/fog
spec/fog/metering_spec.rb
Ruby
mit
4,298
master
440
require "spec_helper" describe Fog::Metering do Fog::Metering.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :creden...
github
fog/fog
https://github.com/fog/fog
spec/fog/storage_spec.rb
Ruby
mit
4,298
master
437
require "spec_helper" describe Fog::Storage do Fog::Storage.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credenti...
github
fog/fog
https://github.com/fog/fog
spec/fog/volume_spec.rb
Ruby
mit
4,298
master
434
require "spec_helper" describe Fog::Volume do Fog::Volume.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credential...
github
fog/fog
https://github.com/fog/fog
spec/fog/cdn_spec.rb
Ruby
mit
4,298
master
425
require "spec_helper" describe Fog::CDN do Fog::CDN.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :credentials, {} ...
github
fog/fog
https://github.com/fog/fog
spec/fog/monitoring_spec.rb
Ruby
mit
4,298
master
446
require "spec_helper" describe Fog::Monitoring do Fog::Monitoring.providers.each do |provider| describe "when #{provider} is passed with no available credentials" do it "returns ArgumentError" do # Stub credentials so you still see errors where the tester really has credentials Fog.stub :cr...