bcms_cas 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -7,6 +7,8 @@ as an example of a server.
7
7
  This module will allow user to login to the public area of the CMS, using the Login Form Portlet. It does not handle users that need to
8
8
  log into the CMS administrative area. It also handles single logout by redirecting the user to cas /logout service.
9
9
 
10
+ As of 1.0.1, this is now managed via gemcutter.
11
+
10
12
  ## A. Instructions
11
13
  Here are the necessary steps to install this module.
12
14
 
@@ -79,6 +81,14 @@ The key changes are:
79
81
  2. You need to add helpers for login_ticket_tag and service_url_tag. These generate hidden parameters CAS services need.
80
82
  3. Change the username parameter from :login to :username
81
83
 
84
+ You must also create a file in your project called: app/portlets/helpers/login_portlet_helper.rb, with the following contents:
85
+
86
+ module LoginPortletHelper
87
+ include Cas::Login
88
+ end
89
+
90
+ This will add the needed methods for the above class.
91
+
82
92
  F. Known Issues
83
93
 
84
94
  * Every page is secured by the CASClient Gateway Filter, which means a lot of redirects. This is potentially a big performance hit, and would require modifying the filter so it only handles checking login_tickets, rather than redirects.
data/lib/bcms_cas.rb CHANGED
@@ -1,2 +1,3 @@
1
1
  require 'bcms_cas/routes'
2
2
  require 'cas/authentication'
3
+ require 'cas/login_portlet_extension'
@@ -1,6 +1,7 @@
1
- # This assumes there is no existing LoginPortletHelper defined in the Core CMS project, and provides one
2
- # to simplify what users need to do in the form.
3
- module LoginPortletHelper
1
+ ##
2
+ # This file needs to be included in a file called app/portlets/helpers/login_portlet_helper.rb
3
+ # in the project. See installation instructions in the README for details.
4
+ module Cas::LoginPortlet
4
5
 
5
6
  # Generates the hidden field for the service_url that the CAS server expects, which tells it where to redirect to. Must create
6
7
  # an absolute URL.
@@ -12,4 +13,10 @@ module LoginPortletHelper
12
13
  def login_ticket_tag
13
14
  hidden_field_tag :lt, Cas::Utils.fetch_lt_from_cas
14
15
  end
16
+
17
+ ##
18
+ # Returns the URL to the CAS login service.
19
+ def login_url
20
+ CASClient::Frameworks::Rails::Filter.login_url
21
+ end
15
22
  end
data/lib/cas/utils.rb CHANGED
@@ -2,6 +2,8 @@
2
2
  # Customizes behavior of CASFilter.
3
3
  #
4
4
  module Cas
5
+
6
+ VERSION = ""
5
7
  class Utils
6
8
  # This is a wrapper around the default behavior of the CASClient Rails filter.
7
9
  #
@@ -0,0 +1,33 @@
1
+ require "test_helper"
2
+ require 'mocha'
3
+
4
+ class LoginObject
5
+ include Cas::LoginPortlet
6
+ end
7
+
8
+ class LoginPortletTest < ActiveSupport::TestCase
9
+
10
+ test "service_url_tag" do
11
+ obj = LoginObject.new
12
+ assert obj.respond_to?(:service_url_tag)
13
+ end
14
+
15
+ test "login_ticket_tag" do
16
+ obj = LoginObject.new
17
+ assert obj.respond_to?(:login_ticket_tag)
18
+ end
19
+
20
+ test "login_service_url exists" do
21
+ obj = LoginObject.new
22
+ assert obj.respond_to?(:login_url)
23
+ end
24
+
25
+ test "Returns the login service from Cas" do
26
+ CASClient::Frameworks::Rails::Filter.expects(:login_url).returns("http://example.com")
27
+
28
+ obj = LoginObject.new
29
+
30
+ assert_equal "http://example.com", obj.login_url
31
+ end
32
+
33
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcms_cas
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - BrowserMedia
@@ -9,11 +9,30 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-05 00:00:00 -05:00
12
+ date: 2010-01-19 00:00:00 -05:00
13
13
  default_executable:
14
- dependencies: []
15
-
16
- description:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: browsercms
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 3.0.6
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rubycas-client
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ description: Allows a BrowserCMS project to connect to a CAS server to authenticate users.
17
36
  email: github@browsermedia.com
18
37
  executables: []
19
38
 
@@ -23,11 +42,11 @@ extra_rdoc_files:
23
42
  - README.markdown
24
43
  files:
25
44
  - app/models/cas_user.rb
26
- - app/portlets/helpers/login_portlet_helper.rb
27
45
  - db/migrate/20091002162550_add_cas_user_group.rb
28
46
  - lib/bcms_cas.rb
29
47
  - lib/bcms_cas/routes.rb
30
48
  - lib/cas/authentication.rb
49
+ - lib/cas/login_portlet_extension.rb
31
50
  - lib/cas/utils.rb
32
51
  - rails/init.rb
33
52
  - README.markdown
@@ -55,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
74
  requirements: []
56
75
 
57
76
  rubyforge_project: browsercms
58
- rubygems_version: 1.3.4
77
+ rubygems_version: 1.3.5
59
78
  signing_key:
60
79
  specification_version: 3
61
80
  summary: A CAS Module for BrowserCMS
@@ -63,6 +82,7 @@ test_files:
63
82
  - test/performance/browsing_test.rb
64
83
  - test/test_helper.rb
65
84
  - test/unit/cas/cas_authentication_test.rb
85
+ - test/unit/cas/login_portlet_test.rb
66
86
  - test/unit/cas_user_test.rb
67
87
  - test/unit/cas_utils_test.rb
68
88
  - test/unit/helpers/login_portlet_helper_test.rb