lib/castronaut/models/ticket_granting_ticket.rb in masover-castronaut-0.4.4.4 vs lib/castronaut/models/ticket_granting_ticket.rb in masover-castronaut-0.4.4.5
- old
+ new
@@ -6,30 +6,30 @@
include Castronaut::Models::Dispenser
has_many :service_tickets, :dependent => :destroy
before_validation :dispense_ticket, :if => :new_record?
- validates_presence_of :ticket, :username
+ validates_presence_of :ticket, :identifier
def self.validate_cookie(ticket_cookie)
Castronaut.logger.debug("#{self} - Validating ticket for #{ticket_cookie}")
return Castronaut::TicketResult.new(nil, "No ticket granting ticket given", 'warn') if ticket_cookie.nil?
ticket_granting_ticket = find_by_ticket(ticket_cookie)
if ticket_granting_ticket
- Castronaut.logger.debug("#{self} -[#{ticket_cookie}] for [#{ticket_granting_ticket.username}] successfully validated.")
+ Castronaut.logger.debug("#{self} -[#{ticket_cookie}] for [#{ticket_granting_ticket.identifier}] successfully validated.")
return Castronaut::TicketResult.new(ticket_granting_ticket, "Your session has expired. Please log in again.", 'warn') if ticket_granting_ticket.expired?
else
Castronaut.logger.debug("#{self} - [#{ticket_cookie}] was not found in the database.")
end
Castronaut::TicketResult.new(ticket_granting_ticket)
end
- def self.generate_for(username, client_host)
- create! :username => username, :client_hostname => client_host
+ def self.generate_for(identifier, client_host)
+ create! :identifier => identifier, :client_hostname => client_host
end
def ticket_prefix
"TGC"
end