Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
use the new helper methods also for normal logins
Browse files Browse the repository at this point in the history
  • Loading branch information
luxflux committed Dec 30, 2012
1 parent 5d7e382 commit a1f0191
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions lib/casino_core/processor/login_credential_acceptor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ class CASinoCore::Processor::LoginCredentialAcceptor < CASinoCore::Processor
include CASinoCore::Helper::Logger
include CASinoCore::Helper::LoginTickets
include CASinoCore::Helper::ServiceTickets
include CASinoCore::Helper::Authentication
include CASinoCore::Helper::TicketGrantingTickets

# Use this method to process the request. It expects the username in the parameter "username" and the password
# in "password".
Expand Down Expand Up @@ -54,27 +56,4 @@ def login_ticket_valid?(lt)
end
end

def validate_login_credentials(username, password)
authentication_result = nil
CASinoCore::Settings.authenticators.each do |authenticator_name, authenticator|
data = authenticator.validate(username, password)
if data
authentication_result = { authenticator: authenticator_name, user_data: data }
logger.info("Credentials for username '#{data[:username]}' successfully validated using authenticator '#{authenticator_name}' (#{authenticator.class})")
break
end
end
authentication_result
end

def acquire_ticket_granting_ticket(authentication_result, user_agent = nil)
user_data = authentication_result[:user_data]
CASinoCore::Model::TicketGrantingTicket.create!({
ticket: random_ticket_string('TGC'),
authenticator: authentication_result[:authenticator],
username: user_data[:username],
extra_attributes: user_data[:extra_attributes],
user_agent: user_agent
})
end
end

0 comments on commit a1f0191

Please sign in to comment.