authlogic_cas 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bfae43109f7fb036aca2341587cee429aaf294b0
4
+ data.tar.gz: 1d50360216629a6c898b5518b956ee56bcdea22a
5
+ SHA512:
6
+ metadata.gz: 415f90d8bce13ca16d38faf7fb0dbe3ca53ffa33f85e676c59e9070a671b802f7fe3441184f482ffe806c574b1a961be84c9b073ee35cefe155bc31ddf863178
7
+ data.tar.gz: 17e2a5e5babf8b7490a9008bf3a6ba28588f39fb813299f48c3b17017089c4b91fb3751ae581e569631f2dc189575f112bcda4e02c6f683f9340eac39169ca17
@@ -0,0 +1,3 @@
1
+ require "authlogic_cas/session"
2
+
3
+ Authlogic::Session::Base.send(:include, AuthlogicCas::Session)
@@ -0,0 +1,49 @@
1
+ module AuthlogicCas
2
+ module Session
3
+ def self.included(klass)
4
+ klass.class_eval do
5
+ include Methods
6
+ end
7
+ end
8
+
9
+ module Methods
10
+ def self.included(klass)
11
+ klass.class_eval do
12
+ skips = [:persist_by_params,:persist_by_session,:persist_by_http_auth]
13
+ if respond_to? :skip_callback
14
+ skips.each {|cb| skip_callback :persist, cb }
15
+ else
16
+ persist.reject {|cb| skips.include?(cb.method)}
17
+ end
18
+ persist :persist_by_cas, :if => :authenticating_with_cas?
19
+ end
20
+ end
21
+
22
+ # no credentials are passed in: the CAS server takes care of that and saving the session
23
+ # def credentials=(value)
24
+ # values = [:garbage]
25
+ # super
26
+ # end
27
+
28
+ def persist_by_cas
29
+ session_key = CASClient::Frameworks::Rails::Filter.client.username_session_key
30
+
31
+ unless controller.session[session_key].blank?
32
+ self.attempted_record = search_for_record("find_by_#{klass.login_field}", controller.session[session_key])
33
+ end
34
+ !self.attempted_record.nil?
35
+ end
36
+
37
+ def authenticating_with_cas?
38
+ attempted_record.nil? && errors.empty? && cas_defined?
39
+ end
40
+
41
+ private
42
+
43
+ #todo: validate that cas filters have run. Authlogic controller adapter doesn't provide access to the filter_chain
44
+ def cas_defined?
45
+ defined?(CASClient::Frameworks::Rails::Filter) && !CASClient::Frameworks::Rails::Filter.config.nil?
46
+ end
47
+ end
48
+ end
49
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: authlogic_cas
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Rich Davis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: authlogic
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubycas-client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: AuthlogicCas is a CAS (a cross-site authentication system designed at
42
+ Yale for single sign-on authentication) add-on for the Authlogic authentication
43
+ system.
44
+ email: ''
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - lib/authlogic_cas.rb
50
+ - lib/authlogic_cas/session.rb
51
+ homepage: https://github.com/thurisaz/authlogic_cas
52
+ licenses:
53
+ - MIT
54
+ metadata: {}
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ requirements: []
70
+ rubyforge_project:
71
+ rubygems_version: 2.0.3
72
+ signing_key:
73
+ specification_version: 4
74
+ summary: Plugin to enable CAS for Authlogic
75
+ test_files: []