casino_core 0.0.4 → 0.0.5

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "casino_core"
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nils Caspar"]
@@ -8,4 +8,8 @@ class CASinoCore::Model::LoginTicket < ActiveRecord::Base
8
8
  def self.cleanup
9
9
  self.delete_all(['created_at < ?', CASinoCore::Settings.login_ticket[:lifetime].seconds.ago])
10
10
  end
11
+
12
+ def to_s
13
+ self.ticket
14
+ end
11
15
  end
@@ -2,10 +2,16 @@ require 'casino_core/processor'
2
2
  require 'casino_core/helper'
3
3
  require 'casino_core/model'
4
4
 
5
+ # The LegacyValidator processor should be used for GET requests to /validate
5
6
  class CASinoCore::Processor::LegacyValidator < CASinoCore::Processor
6
7
  include CASinoCore::Helper::Logger
7
8
  include CASinoCore::Helper::ServiceTickets
8
9
 
10
+ # This method will call `#validation_succeeded` or `#validation_failed`. In both cases, it supplies
11
+ # a string as argument. The webapplication should present that string (and nothing else) to the
12
+ # requestor.
13
+ #
14
+ # @param [Hash] params parameters supplied by requestor (a service)
9
15
  def process(params = nil)
10
16
  params ||= {}
11
17
  ticket = CASinoCore::Model::ServiceTicket.where(ticket: params[:ticket]).first
@@ -1,11 +1,24 @@
1
1
  require 'casino_core/processor'
2
2
  require 'casino_core/helper'
3
3
 
4
+ # This processor should be used for POST requests to /login
4
5
  class CASinoCore::Processor::LoginCredentialAcceptor < CASinoCore::Processor
5
6
  include CASinoCore::Helper::Logger
6
7
  include CASinoCore::Helper::LoginTickets
7
8
  include CASinoCore::Helper::ServiceTickets
8
9
 
10
+ # Use this method to process the request. It expects the username in the parameter "username" and the password
11
+ # in "password".
12
+ #
13
+ # The method will call one of the following methods on the listener:
14
+ # * `#user_logged_in`: The first argument (String) is the URL (if any), the user should be redirected to.
15
+ # The second argument (String) is the ticket-granting ticket. It should be stored in a cookie named "tgt".
16
+ # * `#invalid_login_ticket` and `#invalid_login_credentials`: The first argument is a LoginTicket.
17
+ # See {CASinoCore::Processor::LoginCredentialRequestor} for details.
18
+ #
19
+ # @param [Hash] params parameters supplied by user
20
+ # @param [Hash] cookies cookies supplied by user
21
+ # @param [String] user_agent user-agent delivered by the client
9
22
  def process(params = nil, cookies = nil, user_agent = nil)
10
23
  params ||= {}
11
24
  cookies ||= {}
@@ -1,6 +1,7 @@
1
1
  require 'casino_core/processor'
2
2
  require 'casino_core/helper'
3
3
 
4
+ # This processor should be used for GET requests to /login
4
5
  class CASinoCore::Processor::LoginCredentialRequestor < CASinoCore::Processor
5
6
  include CASinoCore::Helper::Browser
6
7
  include CASinoCore::Helper::Logger
@@ -8,6 +9,15 @@ class CASinoCore::Processor::LoginCredentialRequestor < CASinoCore::Processor
8
9
  include CASinoCore::Helper::ServiceTickets
9
10
  include CASinoCore::Helper::TicketGrantingTickets
10
11
 
12
+ # Use this method to process the request.
13
+ #
14
+ # The method will call one of the following methods on the listener:
15
+ # * `#user_logged_in`: The first argument (String) is the URL (if any), the user should be redirected to.
16
+ # * `#user_not_logged_in`: The first argument is a LoginTicket. It should be stored in a hidden field with name "lt".
17
+ #
18
+ # @param [Hash] params parameters supplied by user
19
+ # @param [Hash] cookies cookies supplied by user
20
+ # @param [String] user_agent user-agent delivered by the client
11
21
  def process(params = nil, cookies = nil, user_agent = nil)
12
22
  params ||= {}
13
23
  cookies ||= {}
@@ -2,9 +2,18 @@ require 'casino_core/processor'
2
2
  require 'casino_core/helper'
3
3
  require 'casino_core/model'
4
4
 
5
+ # The Logout processor should be used to process GET requests to /logout.
5
6
  class CASinoCore::Processor::Logout < CASinoCore::Processor
6
7
  include CASinoCore::Helper::TicketGrantingTickets
7
8
 
9
+ # This method will call `#user_logged_out` and may supply an URL that should be presented to the user.
10
+ # As per specification, the URL specified by "url" SHOULD be on the logout page with descriptive text.
11
+ # For example, "The application you just logged out of has provided a link it would like you to follow.
12
+ # Please click here to access http://www.go-back.edu/."
13
+ #
14
+ # @param [Hash] params parameters supplied by user
15
+ # @param [Hash] cookies cookies supplied by user
16
+ # @param [String] user_agent user-agent delivered by the client
8
17
  def process(params = nil, cookies = nil, user_agent = nil)
9
18
  params ||= {}
10
19
  cookies ||= {}
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: casino_core
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Nils Caspar
@@ -219,7 +219,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - ">="
221
221
  - !ruby/object:Gem::Version
222
- hash: 3879793628887711018
222
+ hash: -263623959609363885
223
223
  segments:
224
224
  - 0
225
225
  version: "0"