Class: Cms::Authentication::TestPasswordStrategy

Inherits:
Devise::Strategies::Authenticatable
  • Object
show all
Defined in:
lib/cms/authentication/test_password_strategy.rb

Overview

For testing external authentication.

Constant Summary collapse

EXPECTED_LOGIN =
EXPECTED_PASSWORD = 'test'

Instance Method Summary collapse

Instance Method Details

#authenticate!Object



6
7
8
9
10
11
12
13
14
# File 'lib/cms/authentication/test_password_strategy.rb', line 6

def authenticate!
  if(authentication_hash[:login] == password && password == EXPECTED_PASSWORD)
    user = Cms::ExternalUser.authenticate(authentication_hash[:login], 'Test Password', {first_name: "Test", last_name: "User"})
    user.authorize(Cms::UsersService::GROUP_CMS_ADMIN, Cms::UsersService::GROUP_CONTENT_EDITOR)
    success!(user)
  else
    pass
  end
end