casino 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. data/.gitignore +23 -0
  2. data/.powrc +4 -0
  3. data/.rspec +1 -0
  4. data/.rvmrc +48 -0
  5. data/.travis.yml +3 -0
  6. data/Gemfile +2 -0
  7. data/Gemfile.lock +129 -0
  8. data/LICENSE.txt +20 -0
  9. data/README.md +72 -0
  10. data/Rakefile +14 -0
  11. data/app/assets/images/rails.png +0 -0
  12. data/app/assets/javascripts/casino/index.js +15 -0
  13. data/app/assets/javascripts/casino/sessions.js.coffee +15 -0
  14. data/app/assets/stylesheets/casino/index.css.scss +28 -0
  15. data/app/controllers/casino/api/v1/tickets_controller.rb +48 -0
  16. data/app/controllers/casino/application_controller.rb +19 -0
  17. data/app/controllers/casino/proxy_tickets_controller.rb +9 -0
  18. data/app/controllers/casino/service_tickets_controller.rb +9 -0
  19. data/app/controllers/casino/sessions_controller.rb +23 -0
  20. data/app/helpers/application_helper.rb +2 -0
  21. data/app/helpers/casino/sessions_helper.rb +5 -0
  22. data/app/helpers/service_tickets_helper.rb +2 -0
  23. data/app/mailers/.gitkeep +0 -0
  24. data/app/models/.gitkeep +0 -0
  25. data/app/views/casino/service_tickets/validate.text.erb +2 -0
  26. data/app/views/casino/sessions/index.html.erb +43 -0
  27. data/app/views/casino/sessions/logout.html.erb +8 -0
  28. data/app/views/casino/sessions/new.html.erb +12 -0
  29. data/app/views/layouts/application.html.erb +18 -0
  30. data/casino.gemspec +29 -0
  31. data/config/.gitignore +3 -0
  32. data/config/initializers/inflections.rb +19 -0
  33. data/config/initializers/mime_types.rb +5 -0
  34. data/config/initializers/wrap_parameters.rb +9 -0
  35. data/config/initializers/yaml.rb +1 -0
  36. data/config/locales/en.yml +10 -0
  37. data/config/routes.rb +82 -0
  38. data/db/seeds.rb +7 -0
  39. data/doc/README_FOR_APP +2 -0
  40. data/lib/assets/.gitkeep +0 -0
  41. data/lib/casino.rb +6 -0
  42. data/lib/casino/engine.rb +7 -0
  43. data/lib/casino/listener.rb +25 -0
  44. data/lib/casino/listener/legacy_validator.rb +11 -0
  45. data/lib/casino/listener/login_credential_acceptor.rb +28 -0
  46. data/lib/casino/listener/login_credential_requestor.rb +16 -0
  47. data/lib/casino/listener/logout.rb +8 -0
  48. data/lib/casino/listener/proxy_ticket_provider.rb +11 -0
  49. data/lib/casino/listener/session_destroyer.rb +11 -0
  50. data/lib/casino/listener/session_overview.rb +11 -0
  51. data/lib/casino/listener/ticket_validator.rb +11 -0
  52. data/lib/casino/version.rb +3 -0
  53. data/lib/generators/casino/install_generator.rb +37 -0
  54. data/lib/generators/casino/templates/README +28 -0
  55. data/lib/generators/casino/templates/cas.yml +44 -0
  56. data/lib/generators/casino/templates/casino.css +3 -0
  57. data/lib/generators/casino/templates/casino.js +1 -0
  58. data/lib/generators/casino/templates/casino_core.rb +1 -0
  59. data/lib/generators/casino/templates/database.yml +25 -0
  60. data/lib/tasks/.gitkeep +0 -0
  61. data/lib/tasks/login_tickets.rake +7 -0
  62. data/lib/tasks/service_tickets.rake +9 -0
  63. data/log/.gitkeep +0 -0
  64. data/public/404.html +26 -0
  65. data/public/422.html +26 -0
  66. data/public/500.html +25 -0
  67. data/public/favicon.ico +0 -0
  68. data/public/robots.txt +5 -0
  69. data/script/rails +8 -0
  70. data/spec/controllers/api/v1/tickets_controller_spec.rb +100 -0
  71. data/spec/controllers/listener/legacy_validator_spec.rb +22 -0
  72. data/spec/controllers/listener/login_credential_acceptor_spec.rb +62 -0
  73. data/spec/controllers/listener/login_credential_requestor_spec.rb +39 -0
  74. data/spec/controllers/listener/logout_spec.rb +21 -0
  75. data/spec/controllers/listener/proxy_ticket_provider_spec.rb +22 -0
  76. data/spec/controllers/listener/session_destroyer_spec.rb +25 -0
  77. data/spec/controllers/listener/session_overview_spec.rb +26 -0
  78. data/spec/controllers/listener/ticket_validator_spec.rb +22 -0
  79. data/spec/controllers/proxy_tickets_controller_spec.rb +25 -0
  80. data/spec/controllers/service_tickets_controller_spec.rb +25 -0
  81. data/spec/controllers/sessions_controller_spec.rb +52 -0
  82. data/spec/dummy/Rakefile +7 -0
  83. data/spec/dummy/app/assets/javascripts/application.js +16 -0
  84. data/spec/dummy/app/assets/stylesheets/application.css +14 -0
  85. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  86. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  87. data/spec/dummy/app/mailers/.gitkeep +0 -0
  88. data/spec/dummy/app/models/.gitkeep +0 -0
  89. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  90. data/spec/dummy/config.ru +4 -0
  91. data/spec/dummy/config/application.rb +59 -0
  92. data/spec/dummy/config/boot.rb +10 -0
  93. data/spec/dummy/config/cas.yml +29 -0
  94. data/spec/dummy/config/database.yml +25 -0
  95. data/spec/dummy/config/environment.rb +5 -0
  96. data/spec/dummy/config/environments/development.rb +37 -0
  97. data/spec/dummy/config/environments/production.rb +67 -0
  98. data/spec/dummy/config/environments/test.rb +37 -0
  99. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  100. data/spec/dummy/config/initializers/casino_core.rb +1 -0
  101. data/spec/dummy/config/initializers/inflections.rb +15 -0
  102. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  103. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  104. data/spec/dummy/config/initializers/session_store.rb +8 -0
  105. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  106. data/spec/dummy/config/locales/en.yml +5 -0
  107. data/spec/dummy/config/routes.rb +4 -0
  108. data/spec/dummy/db/.gitkeep +0 -0
  109. data/spec/dummy/lib/assets/.gitkeep +0 -0
  110. data/spec/dummy/log/.gitkeep +0 -0
  111. data/spec/dummy/public/404.html +26 -0
  112. data/spec/dummy/public/422.html +26 -0
  113. data/spec/dummy/public/500.html +25 -0
  114. data/spec/dummy/public/favicon.ico +0 -0
  115. data/spec/dummy/script/rails +6 -0
  116. data/spec/spec_helper.rb +38 -0
  117. data/spec/support/.gitkeep +0 -0
  118. data/spec/support/sign_in.rb +11 -0
  119. data/vendor/assets/javascripts/.gitkeep +0 -0
  120. data/vendor/assets/stylesheets/.gitkeep +0 -0
  121. data/vendor/plugins/.gitkeep +0 -0
  122. metadata +351 -0
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile ~/.gitignore_global
6
+
7
+ # Ignore bundler config
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+
13
+ # Ignore all logfiles and tempfiles.
14
+ /log/*.log
15
+ /tmp
16
+ .rails_generators~
17
+
18
+ /coverage
19
+
20
+ # Dummy application crap
21
+ /spec/dummy/log/*.log
22
+ /spec/dummy/tmp
23
+ /spec/dummy/db/*.sqlite3
data/.powrc ADDED
@@ -0,0 +1,4 @@
1
+ if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".rvmrc" ]; then
2
+ source "$rvm_path/scripts/rvm"
3
+ source ".rvmrc"
4
+ fi
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color --format documentation
data/.rvmrc ADDED
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
+ # Only full ruby name is supported here, for short names use:
8
+ # echo "rvm use 1.9.3" > .rvmrc
9
+ environment_id="ruby-1.9.3-p194@casino"
10
+
11
+ # Uncomment the following lines if you want to verify rvm version per project
12
+ # rvmrc_rvm_version="1.15.8 (stable)" # 1.10.1 seams as a safe start
13
+ # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
+ # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
+ # return 1
16
+ # }
17
+
18
+ # First we attempt to load the desired environment directly from the environment
19
+ # file. This is very fast and efficient compared to running through the entire
20
+ # CLI and selector. If you want feedback on which environment was used then
21
+ # insert the word 'use' after --create as this triggers verbose mode.
22
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
+ then
25
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
+ [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
+ \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
+ else
29
+ # If the environment file has not yet been created, use the RVM CLI to select.
30
+ rvm --create "$environment_id" || {
31
+ echo "Failed to create RVM environment '${environment_id}'."
32
+ return 1
33
+ }
34
+ fi
35
+
36
+ # If you use bundler, this might be useful to you:
37
+ # if [[ -s Gemfile ]] && {
38
+ # ! builtin command -v bundle >/dev/null ||
39
+ # builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
40
+ # }
41
+ # then
42
+ # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
43
+ # gem install bundler
44
+ # fi
45
+ # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
46
+ # then
47
+ # bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
48
+ # fi
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ before_script:
3
+ - "cd spec/dummy && RAILS_ENV=test rake casino_core:db:schema:load && cd ../.."
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,129 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ casino (0.0.1)
5
+ casino_core (~> 1.0)
6
+ jquery-rails (~> 2.1)
7
+ rails (~> 3.2.9)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actionmailer (3.2.9)
13
+ actionpack (= 3.2.9)
14
+ mail (~> 2.4.4)
15
+ actionpack (3.2.9)
16
+ activemodel (= 3.2.9)
17
+ activesupport (= 3.2.9)
18
+ builder (~> 3.0.0)
19
+ erubis (~> 2.7.0)
20
+ journey (~> 1.0.4)
21
+ rack (~> 1.4.0)
22
+ rack-cache (~> 1.2)
23
+ rack-test (~> 0.6.1)
24
+ sprockets (~> 2.2.1)
25
+ activemodel (3.2.9)
26
+ activesupport (= 3.2.9)
27
+ builder (~> 3.0.0)
28
+ activerecord (3.2.9)
29
+ activemodel (= 3.2.9)
30
+ activesupport (= 3.2.9)
31
+ arel (~> 3.0.2)
32
+ tzinfo (~> 0.3.29)
33
+ activeresource (3.2.9)
34
+ activemodel (= 3.2.9)
35
+ activesupport (= 3.2.9)
36
+ activesupport (3.2.9)
37
+ i18n (~> 0.6)
38
+ multi_json (~> 1.0)
39
+ addressable (2.3.2)
40
+ arel (3.0.2)
41
+ builder (3.0.4)
42
+ casino_core (1.0.12)
43
+ activerecord (~> 3.2.9)
44
+ addressable (~> 2.3)
45
+ useragent (~> 0.4)
46
+ diff-lcs (1.1.3)
47
+ erubis (2.7.0)
48
+ hike (1.2.1)
49
+ i18n (0.6.1)
50
+ journey (1.0.4)
51
+ jquery-rails (2.1.4)
52
+ railties (>= 3.0, < 5.0)
53
+ thor (>= 0.14, < 2.0)
54
+ json (1.7.6)
55
+ mail (2.4.4)
56
+ i18n (>= 0.4.0)
57
+ mime-types (~> 1.16)
58
+ treetop (~> 1.4.8)
59
+ mime-types (1.19)
60
+ multi_json (1.5.0)
61
+ polyglot (0.3.3)
62
+ rack (1.4.1)
63
+ rack-cache (1.2)
64
+ rack (>= 0.4)
65
+ rack-ssl (1.3.2)
66
+ rack
67
+ rack-test (0.6.2)
68
+ rack (>= 1.0)
69
+ rails (3.2.9)
70
+ actionmailer (= 3.2.9)
71
+ actionpack (= 3.2.9)
72
+ activerecord (= 3.2.9)
73
+ activeresource (= 3.2.9)
74
+ activesupport (= 3.2.9)
75
+ bundler (~> 1.0)
76
+ railties (= 3.2.9)
77
+ railties (3.2.9)
78
+ actionpack (= 3.2.9)
79
+ activesupport (= 3.2.9)
80
+ rack-ssl (~> 1.3.2)
81
+ rake (>= 0.8.7)
82
+ rdoc (~> 3.4)
83
+ thor (>= 0.14.6, < 2.0)
84
+ rake (10.0.3)
85
+ rdoc (3.12)
86
+ json (~> 1.4)
87
+ rspec (2.12.0)
88
+ rspec-core (~> 2.12.0)
89
+ rspec-expectations (~> 2.12.0)
90
+ rspec-mocks (~> 2.12.0)
91
+ rspec-core (2.12.2)
92
+ rspec-expectations (2.12.1)
93
+ diff-lcs (~> 1.1.3)
94
+ rspec-mocks (2.12.1)
95
+ rspec-rails (2.12.0)
96
+ actionpack (>= 3.0)
97
+ activesupport (>= 3.0)
98
+ railties (>= 3.0)
99
+ rspec-core (~> 2.12.0)
100
+ rspec-expectations (~> 2.12.0)
101
+ rspec-mocks (~> 2.12.0)
102
+ simplecov (0.7.1)
103
+ multi_json (~> 1.0)
104
+ simplecov-html (~> 0.7.1)
105
+ simplecov-html (0.7.1)
106
+ sprockets (2.2.2)
107
+ hike (~> 1.2)
108
+ multi_json (~> 1.0)
109
+ rack (~> 1.0)
110
+ tilt (~> 1.1, != 1.3.0)
111
+ sqlite3 (1.3.6)
112
+ thor (0.16.0)
113
+ tilt (1.3.3)
114
+ treetop (1.4.12)
115
+ polyglot
116
+ polyglot (>= 0.3.1)
117
+ tzinfo (0.3.35)
118
+ useragent (0.4.15)
119
+
120
+ PLATFORMS
121
+ ruby
122
+
123
+ DEPENDENCIES
124
+ casino!
125
+ rake (~> 10.0)
126
+ rspec (~> 2.12)
127
+ rspec-rails (~> 2.0)
128
+ simplecov (~> 0.7)
129
+ sqlite3 (~> 1.3)
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Nils Caspar
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # CASino [![Build Status](https://secure.travis-ci.org/rbCAS/CASino.png?branch=master)](https://travis-ci.org/rbCAS/CASino)
2
+
3
+ A simple [CAS](http://www.jasig.org/cas) server written in Ruby using the Rails framework.
4
+
5
+ It currently supports [CAS 1.0 and CAS 2.0](http://www.jasig.org/cas/protocol) as well as [CAS 3.1 Single Sign Out](https://wiki.jasig.org/display/CASUM/Single+Sign+Out) and [CAS RESTful API](https://wiki.jasig.org/display/CASUM/RESTful+API).
6
+
7
+ CASino is separated into a web app and core components:
8
+
9
+ * CASino is the web application (using the Rails framework)
10
+ * CASinoCore contains all the CAS server logic
11
+
12
+ This simplifies the creation of a CAS server implementation for other developers.
13
+
14
+ ## Setup
15
+
16
+ ### 1. Create a Ruby on Rails application
17
+
18
+ Make sure you installed Ruby on Rails 3.2.x!
19
+
20
+ rails new my-casino --skip-active-record --skip-test-unit --skip-bundle
21
+ cd my-casino
22
+
23
+ ### 2. Include and install CASino engine gem
24
+
25
+ Edit your application's Gemfile and add these lines if missing:
26
+
27
+ gem 'sqlite3', '~> 1.3'
28
+ gem 'casino'
29
+
30
+ Run `bundle install` afterwards.
31
+
32
+ ### 3. Generate the initial configuration
33
+
34
+ bundle exec rails g casino:install
35
+
36
+ ### 4. Edit the configuration
37
+
38
+ mate config/cas.yml
39
+ mate config/database.yml
40
+
41
+ Information about configuration can be found in our Wiki: [Configuration](https://github.com/pencil/CASino/wiki/Configuration)
42
+
43
+ ### 5. Load the database
44
+
45
+ Load the default DB schema with `rake casino_core:db:schema:load`. After an update, run `rake casino_core:db:migrate` instead.
46
+
47
+ ### 6. Configure a cronjob
48
+
49
+ Configure a cronjob to do a `rake casino_core:cleanup:all > /dev/null` every 5 minutes. This is not essential in a development environment.
50
+
51
+ ### 7. Customize it!
52
+
53
+ Learn how to customize your CASino installation: [Customization](https://github.com/pencil/CASino/wiki/Customization)
54
+
55
+ ### 8. Ship it!
56
+
57
+ To start the server in a development environment, run:
58
+
59
+ bundle exec rails s
60
+
61
+ ## Contributing to CASino
62
+
63
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
64
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
65
+ * Fork the project.
66
+ * Start a feature/bugfix branch.
67
+ * Commit and push until you are happy with your contribution.
68
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
69
+
70
+ ## Copyright
71
+
72
+ Copyright (c) 2012 Nils Caspar. See LICENSE.txt for further details.
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env rake
2
+ require 'bundler'
3
+ require 'rake'
4
+ require 'bundler/gem_tasks'
5
+ require 'rspec/core/rake_task'
6
+
7
+ require 'casino_core'
8
+
9
+ task :default => :spec
10
+
11
+ desc 'Run all specs'
12
+ RSpec::Core::RakeTask.new(:spec) do |spec|
13
+ spec.pattern = FileList['spec/**/*_spec.rb']
14
+ end
Binary file
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
4
+ jQuery ->
5
+ if $('#login-form').length
6
+ cookie_regex = /(^|;)\s*tgt=/
7
+ checkCookieExists = ->
8
+ if(cookie_regex.test(document.cookie))
9
+ service = $('#service').val()
10
+ url = '/login'
11
+ url += ('?service=' + encodeURIComponent(service)) if service
12
+ window.location = url
13
+ else
14
+ setTimeout(checkCookieExists, 1000)
15
+ checkCookieExists()
@@ -0,0 +1,28 @@
1
+ body {
2
+ color: black;
3
+ font-family: "lucida grande", arial,sans-serif;
4
+ font-size: 0.8em;
5
+ }
6
+
7
+ table {
8
+ border-collapse: collapse;
9
+
10
+ thead {
11
+ border-bottom: 1px dotted #aaa;
12
+ }
13
+
14
+ th, td {
15
+ text-align: left;
16
+ padding: 8px;
17
+ }
18
+
19
+ tbody {
20
+ tr:nth-child(even) {
21
+ background-color: #f4faff;
22
+ }
23
+
24
+ tr.highlighted {
25
+ background-color: #fef4ca;
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,48 @@
1
+ class CASino::API::V1::TicketsController < CASino::ApplicationController
2
+
3
+ # POST /cas/v1/tickets
4
+ def create
5
+ CASinoCore::Processor::API::LoginCredentialAcceptor.new(self).process(params, request.user_agent)
6
+ end
7
+
8
+ # POST /cas/v1/tickets/{TGT id}
9
+ def update
10
+ CASinoCore::Processor::API::ServiceTicketProvider.new(self).process(params[:id], params, request.user_agent)
11
+ end
12
+
13
+ # DELETE /cas/v1/tickets/TGT-fdsjfsdfjkalfewrihfdhfaie
14
+ def destroy
15
+ CASinoCore::Processor::API::Logout.new(self).process(params[:id], request.user_agent)
16
+ end
17
+
18
+ # callbacks
19
+ def user_logged_in_via_api(ticket_granting_ticket)
20
+ render nothing: true, status: 201, location: api_v1_ticket_url(ticket_granting_ticket)
21
+ end
22
+
23
+ def invalid_login_credentials_via_api
24
+ error_response
25
+ end
26
+
27
+ def granted_service_ticket_via_api(service_ticket)
28
+ render text: service_ticket, status: 200, content_type: Mime::TEXT
29
+ end
30
+
31
+ def invalid_ticket_granting_ticket_via_api
32
+ error_response
33
+ end
34
+
35
+ def no_service_provided_via_api
36
+ error_response
37
+ end
38
+
39
+ def user_logged_out_via_api
40
+ render nothing: true, status: 200
41
+ end
42
+
43
+ private
44
+ def error_response
45
+ render nothing: true, status: 400
46
+ end
47
+
48
+ end