Class: CAS::Receipt

Inherits:
Object
  • Object
show all
Defined in:
lib/cas.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptv) ⇒ Receipt

Returns a new instance of Receipt.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cas.rb', line 21

def initialize(ptv)
  if !ptv.successful_authentication?
    begin
      ptv.validate
    rescue ValidationException=>vald
      raise AuthenticationException, "Unable to validate ProxyTicketValidator [#{ptv}] [#{vald}]"
    end
    raise AuthenticationException, "Unable to validate ProxyTicketValidator because of no success with validation[#{ptv}]" unless ptv.successful_authentication?
  end
  self.validate_url = ptv.validate_url
  self.pgt_iou = ptv.pgt_iou
  self.user_name = ptv.user
  self.proxy_callback_url = ptv.proxy_callback_url
  self.proxy_list = ptv.proxy_list
  self.primary_authentication = ptv.renewed?
  raise AuthenticationException, "Validation of [#{ptv}] did not result in an internally consistent Receipt" unless validate
end

Instance Attribute Details

#pgt_iouObject

Returns the value of attribute pgt_iou.



15
16
17
# File 'lib/cas.rb', line 15

def pgt_iou
  @pgt_iou
end

#primary_authenticationObject

Returns the value of attribute primary_authentication.



15
16
17
# File 'lib/cas.rb', line 15

def primary_authentication
  @primary_authentication
end

#proxy_callback_urlObject

Returns the value of attribute proxy_callback_url.



15
16
17
# File 'lib/cas.rb', line 15

def proxy_callback_url
  @proxy_callback_url
end

#proxy_listObject

Returns the value of attribute proxy_list.



15
16
17
# File 'lib/cas.rb', line 15

def proxy_list
  @proxy_list
end

#user_nameObject

Returns the value of attribute user_name.



15
16
17
# File 'lib/cas.rb', line 15

def user_name
  @user_name
end

#validate_urlObject

Returns the value of attribute validate_url.



15
16
17
# File 'lib/cas.rb', line 15

def validate_url
  @validate_url
end

Instance Method Details

#primary_authentication?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/cas.rb', line 17

def primary_authentication?
  primary_authentication
end

#proxied?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/cas.rb', line 39

def proxied?
  !proxy_list.empty?
end

#proxying_serviceObject



43
44
45
# File 'lib/cas.rb', line 43

def proxying_service
  proxy_list.first
end

#to_sObject



47
48
49
# File 'lib/cas.rb', line 47

def to_s
  "[#{super} - userName=[#{user_name}] validateUrl=[#{validate_url}] proxyCallbackUrl=[#{proxy_callback_url}] pgtIou=[#{pgt_iou}] proxyList=[#{proxy_list}]"
end

#validateObject



51
52
53
54
55
56
# File 'lib/cas.rb', line 51

def validate
  user_name &&
    validate_url &&
    proxy_list &&
    !(primary_authentication? && !proxy_list.empty?) # May not be both primary authenitication and proxied.
end