29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/cassette/authentication.rb', line 29
def ticket_user(ticket, service = config.service)
cache.fetch_authentication(ticket, service) do
begin
logger.info("Validating #{ticket} on #{validate_path}")
response = http.get(validate_path, ticket: ticket, service: service).body
ticket_response = Http::TicketResponse.new(response)
logger.info("Validation resut: #{response.inspect}")
return nil unless ticket_response.login
Cassette::Authentication::User.new(
login: ticket_response.login,
name: ticket_response.name,
authorities: ticket_response.authorities,
extra_attributes: ticket_response.,
ticket: ticket,
config: config
)
rescue => exception
logger.error "Error while authenticating ticket #{ticket}: #{exception.message}"
raise Cassette::Errors::Forbidden, exception.message
end
end
end
|