Class: Castronaut::Presenters::ServiceValidate
- Inherits:
-
Object
- Object
- Castronaut::Presenters::ServiceValidate
- Defined in:
- lib/castronaut/presenters/service_validate.rb
Constant Summary collapse
- MissingCredentialsMessage =
"Please supply a username and password to login."
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#login_ticket ⇒ Object
Returns the value of attribute login_ticket.
-
#messages ⇒ Object
Returns the value of attribute messages.
-
#your_mission ⇒ Object
readonly
Returns the value of attribute your_mission.
Instance Method Summary collapse
- #client_host ⇒ Object
-
#initialize(controller) ⇒ ServiceValidate
constructor
A new instance of ServiceValidate.
- #proxy_granting_ticket_iou ⇒ Object
- #proxy_granting_ticket_url ⇒ Object
- #renewal ⇒ Object
- #represent! ⇒ Object
- #service ⇒ Object
- #service_ticket_result ⇒ Object
- #ticket ⇒ Object
- #username ⇒ Object
Constructor Details
#initialize(controller) ⇒ ServiceValidate
Returns a new instance of ServiceValidate.
13 14 15 16 17 |
# File 'lib/castronaut/presenters/service_validate.rb', line 13 def initialize(controller) @controller = controller @messages = [] @your_mission = nil end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
7 8 9 |
# File 'lib/castronaut/presenters/service_validate.rb', line 7 def controller @controller end |
#login_ticket ⇒ Object
Returns the value of attribute login_ticket.
8 9 10 |
# File 'lib/castronaut/presenters/service_validate.rb', line 8 def login_ticket @login_ticket end |
#messages ⇒ Object
Returns the value of attribute messages.
8 9 10 |
# File 'lib/castronaut/presenters/service_validate.rb', line 8 def @messages end |
#your_mission ⇒ Object (readonly)
Returns the value of attribute your_mission.
7 8 9 |
# File 'lib/castronaut/presenters/service_validate.rb', line 7 def your_mission @your_mission end |
Instance Method Details
#client_host ⇒ Object
43 44 45 |
# File 'lib/castronaut/presenters/service_validate.rb', line 43 def client_host env['HTTP_X_FORWARDED_FOR'] || env['REMOTE_HOST'] || env['REMOTE_ADDR'] end |
#proxy_granting_ticket_iou ⇒ Object
35 36 37 |
# File 'lib/castronaut/presenters/service_validate.rb', line 35 def proxy_granting_ticket_iou @proxy_granting_ticket_result && @proxy_granting_ticket_result.iou end |
#proxy_granting_ticket_url ⇒ Object
31 32 33 |
# File 'lib/castronaut/presenters/service_validate.rb', line 31 def proxy_granting_ticket_url params['pgtUrl'] end |
#renewal ⇒ Object
23 24 25 |
# File 'lib/castronaut/presenters/service_validate.rb', line 23 def renewal params['renew'] end |
#represent! ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/castronaut/presenters/service_validate.rb', line 51 def represent! @service_ticket_result = Castronaut::Models::ServiceTicket.validate_ticket(service, ticket) if @service_ticket_result.valid? if proxy_granting_ticket_url @proxy_granting_ticket_result = Castronaut::Models::ProxyGrantingTicket.generate_ticket(proxy_granting_ticket_url, client_host, @service_ticket_result.ticket) end end @your_mission = lambda { controller.erb :service_validate, :layout => false, :locals => { :presenter => self } } self end |
#service ⇒ Object
19 20 21 |
# File 'lib/castronaut/presenters/service_validate.rb', line 19 def service params['service'] end |
#service_ticket_result ⇒ Object
47 48 49 |
# File 'lib/castronaut/presenters/service_validate.rb', line 47 def service_ticket_result @service_ticket_result end |
#ticket ⇒ Object
27 28 29 |
# File 'lib/castronaut/presenters/service_validate.rb', line 27 def ticket params['ticket'] end |
#username ⇒ Object
39 40 41 |
# File 'lib/castronaut/presenters/service_validate.rb', line 39 def username @service_ticket_result.username end |