authlogic_crowd_rest 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+ gem "authlogic"
3
+
4
+ # Add dependencies to develop your gem here.
5
+ # Include everything needed to run rake, tests, features, etc.
6
+ group :development do
7
+ gem "bundler", "~> 1.0.0"
8
+ gem "jeweler", "~> 1.5.2"
9
+ gem "rcov", ">= 0"
10
+ gem "actionpack"
11
+ gem "activerecord", :require=>"active_record"
12
+ gem "sqlite3"
13
+ gem "webmock"
14
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,63 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ abstract (1.0.0)
5
+ actionpack (3.0.4)
6
+ activemodel (= 3.0.4)
7
+ activesupport (= 3.0.4)
8
+ builder (~> 2.1.2)
9
+ erubis (~> 2.6.6)
10
+ i18n (~> 0.4)
11
+ rack (~> 1.2.1)
12
+ rack-mount (~> 0.6.13)
13
+ rack-test (~> 0.5.7)
14
+ tzinfo (~> 0.3.23)
15
+ activemodel (3.0.4)
16
+ activesupport (= 3.0.4)
17
+ builder (~> 2.1.2)
18
+ i18n (~> 0.4)
19
+ activerecord (3.0.4)
20
+ activemodel (= 3.0.4)
21
+ activesupport (= 3.0.4)
22
+ arel (~> 2.0.2)
23
+ tzinfo (~> 0.3.23)
24
+ activesupport (3.0.4)
25
+ addressable (2.2.4)
26
+ arel (2.0.9)
27
+ authlogic (2.1.6)
28
+ activesupport
29
+ builder (2.1.2)
30
+ crack (0.1.8)
31
+ erubis (2.6.6)
32
+ abstract (>= 1.0.0)
33
+ git (1.2.5)
34
+ i18n (0.5.0)
35
+ jeweler (1.5.2)
36
+ bundler (~> 1.0.0)
37
+ git (>= 1.2.5)
38
+ rake
39
+ rack (1.2.1)
40
+ rack-mount (0.6.13)
41
+ rack (>= 1.0.0)
42
+ rack-test (0.5.7)
43
+ rack (>= 1.0)
44
+ rake (0.8.7)
45
+ rcov (0.9.9)
46
+ sqlite3 (1.3.3)
47
+ tzinfo (0.3.24)
48
+ webmock (1.6.2)
49
+ addressable (>= 2.2.2)
50
+ crack (>= 0.1.7)
51
+
52
+ PLATFORMS
53
+ ruby
54
+
55
+ DEPENDENCIES
56
+ actionpack
57
+ activerecord
58
+ authlogic
59
+ bundler (~> 1.0.0)
60
+ jeweler (~> 1.5.2)
61
+ rcov
62
+ sqlite3
63
+ webmock
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Rob Di Marco
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/MIT-LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2011 Rob Di Marco of 416 Software (416software.com)
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.
21
+
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = authlogic_crowd_rest
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to authlogic_crowd_rest
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2011 Rob Di Marco. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,54 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.require(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "authlogic_crowd_rest"
16
+ gem.homepage = "http://github.com/robdimarco/authlogic_crowd_rest"
17
+ gem.license = "MIT"
18
+ gem.summary = %Q{An Authlogic plugin to connect with Atlassian Crowd REST APIs}
19
+ gem.description = %Q{Foo}
20
+ gem.email = "rob.dimarco@416software.com"
21
+ gem.authors = ["Rob Di Marco"]
22
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
23
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
25
+ # gem.add_development_dependency 'activerecord'
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rake/testtask'
30
+ Rake::TestTask.new(:test) do |test|
31
+ test.libs << 'lib' << 'test'
32
+ test.pattern = 'test/**/*_test.rb'
33
+ test.verbose = true
34
+ end
35
+
36
+ require 'rcov/rcovtask'
37
+ Rcov::RcovTask.new do |test|
38
+ test.libs << 'test'
39
+ test.pattern = 'test/**/test_*.rb'
40
+ test.verbose = true
41
+ end
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "authlogic_crowd_rest #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
54
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,85 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{authlogic_crowd_rest}
8
+ s.version = "1.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Rob Di Marco"]
12
+ s.date = %q{2011-02-26}
13
+ s.description = %q{Foo}
14
+ s.email = %q{rob.dimarco@416software.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "MIT-LICENSE",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "authlogic_crowd_rest.gemspec",
29
+ "lib/authlogic_crowd_rest.rb",
30
+ "lib/authlogic_crowd_rest/acts_as_authentic.rb",
31
+ "lib/authlogic_crowd_rest/session.rb",
32
+ "lib/authlogic_crowd_rest/version.rb",
33
+ "test/acts_as_authentic_test.rb",
34
+ "test/libs/user.rb",
35
+ "test/libs/user_session.rb",
36
+ "test/session_test.rb",
37
+ "test/test_helper.rb"
38
+ ]
39
+ s.homepage = %q{http://github.com/robdimarco/authlogic_crowd_rest}
40
+ s.licenses = ["MIT"]
41
+ s.require_paths = ["lib"]
42
+ s.rubygems_version = %q{1.5.2}
43
+ s.summary = %q{An Authlogic plugin to connect with Atlassian Crowd REST APIs}
44
+ s.test_files = [
45
+ "test/acts_as_authentic_test.rb",
46
+ "test/libs/user.rb",
47
+ "test/libs/user_session.rb",
48
+ "test/session_test.rb",
49
+ "test/test_helper.rb"
50
+ ]
51
+
52
+ if s.respond_to? :specification_version then
53
+ s.specification_version = 3
54
+
55
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
56
+ s.add_runtime_dependency(%q<authlogic>, [">= 0"])
57
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
58
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
59
+ s.add_development_dependency(%q<rcov>, [">= 0"])
60
+ s.add_development_dependency(%q<actionpack>, [">= 0"])
61
+ s.add_development_dependency(%q<activerecord>, [">= 0"])
62
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
63
+ s.add_development_dependency(%q<webmock>, [">= 0"])
64
+ else
65
+ s.add_dependency(%q<authlogic>, [">= 0"])
66
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
67
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
68
+ s.add_dependency(%q<rcov>, [">= 0"])
69
+ s.add_dependency(%q<actionpack>, [">= 0"])
70
+ s.add_dependency(%q<activerecord>, [">= 0"])
71
+ s.add_dependency(%q<sqlite3>, [">= 0"])
72
+ s.add_dependency(%q<webmock>, [">= 0"])
73
+ end
74
+ else
75
+ s.add_dependency(%q<authlogic>, [">= 0"])
76
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
77
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
78
+ s.add_dependency(%q<rcov>, [">= 0"])
79
+ s.add_dependency(%q<actionpack>, [">= 0"])
80
+ s.add_dependency(%q<activerecord>, [">= 0"])
81
+ s.add_dependency(%q<sqlite3>, [">= 0"])
82
+ s.add_dependency(%q<webmock>, [">= 0"])
83
+ end
84
+ end
85
+
@@ -0,0 +1,20 @@
1
+ module AuthlogicCrowdRest
2
+ module ActsAsAuthentic
3
+ def self.included(klass)
4
+ klass.class_eval do
5
+ extend Config
6
+ add_acts_as_authentic_module(Methods, :prepend)
7
+ end
8
+ end
9
+
10
+ module Config
11
+ end
12
+
13
+ module Methods
14
+ def self.included(klass)
15
+ klass.class_eval do
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,109 @@
1
+ module AuthlogicCrowdRest
2
+ module Session
3
+ def self.included(klass)
4
+ klass.class_eval do
5
+ extend Config
6
+ include Methods
7
+ end
8
+ end
9
+
10
+ module Config
11
+ # The URL of your crowd rest API. Should be
12
+ # something like https://localhost:8095/crowd/rest
13
+ #
14
+ # * <tt>Default:</tt> nil
15
+ # * <tt>Accepts:</tt> String
16
+ def crowd_base_url(value = nil)
17
+ rw_config(:crowd_base_url, value)
18
+ end
19
+ alias_method :crowd_base_url=, :crowd_base_url
20
+
21
+ # The name in crowd for your application
22
+ #
23
+ # * <tt>Default:</tt> nil
24
+ # * <tt>Accepts:</tt> String
25
+ def crowd_application_name(value = nil)
26
+ rw_config(:crowd_application_name, value)
27
+ end
28
+ alias_method :crowd_application_name=, :crowd_application_name
29
+
30
+ # The password in crowd for your application
31
+ #
32
+ # * <tt>Default:</tt> nil
33
+ # * <tt>Accepts:</tt> String
34
+ def crowd_application_password(value = nil)
35
+ rw_config(:crowd_application_password, value)
36
+ end
37
+ alias_method :crowd_application_password=, :crowd_application_password
38
+ end
39
+
40
+ module Methods
41
+ def self.included(klass)
42
+ klass.class_eval do
43
+ validate :validate_by_crowd_rest, :if => :authenticating_with_crowd_rest?
44
+ end
45
+ end
46
+
47
+ private
48
+ def authenticating_with_crowd_rest?
49
+ !(crowd_base_url.blank? || crowd_application_name.blank? || crowd_application_password.blank?)
50
+ end
51
+
52
+ def validate_by_crowd_rest
53
+ self.invalid_password = false
54
+ errors.add(login_field, I18n.t('error_messages.login_blank', :default => "cannot be blank")) if send(login_field).blank?
55
+ errors.add(password_field, I18n.t('error_messages.password_blank', :default => "cannot be blank")) if send("protected_#{password_field}").blank?
56
+ return if errors.count > 0
57
+
58
+ self.attempted_record = search_for_record(find_by_login_method, send(login_field))
59
+ if attempted_record.blank?
60
+ generalize_credentials_error_messages? ?
61
+ add_general_credentials_error :
62
+ errors.add(login_field, I18n.t('error_messages.login_not_found', :default => "is not valid"))
63
+ return
64
+ end
65
+
66
+ if !(send( :verify_crowd_password, attempted_record))
67
+ puts "Invalid!"
68
+ self.invalid_password = true
69
+ generalize_credentials_error_messages? ?
70
+ add_general_credentials_error :
71
+ errors.add(password_field, I18n.t('error_messages.password_invalid', :default => "is not valid"))
72
+ return
73
+ end
74
+ end
75
+
76
+ def verify_crowd_password(attempted_record)
77
+ password = attempted_record.send(verify_password_method, send("protected_#{password_field}"))
78
+ require 'net/http'
79
+ require 'net/https'
80
+ uri = URI.parse(send("crowd_base_url"))
81
+
82
+ begin
83
+ Net::HTTP.start(uri.host, uri.port) {|http|
84
+ http.use_ssl = uri.scheme == "https"
85
+ req = Net::HTTP::Post.new(uri.path + "?" + "username=#{attempted_record.login}")
86
+ req.basic_auth send("crowd_application_name"), send("crowd_application_password")
87
+ req.body="<password><value>#{send("protected_#{password_field}")}</value></password>"
88
+ req.add_field 'Content-Type', 'text/xml'
89
+ resp, data = http.request(req)
90
+ resp.code.to_i == 200
91
+ }
92
+ rescue Interrupt
93
+ errors.add(password_field, I18n.t('error_messages.crowd_password_timeout', :default=>"Timeout occurred when connecting to crowd"))
94
+ end
95
+ end
96
+
97
+ def crowd_application_password
98
+ self.class.crowd_application_password
99
+ end
100
+
101
+ def crowd_application_name
102
+ self.class.crowd_application_name
103
+ end
104
+ def crowd_base_url
105
+ self.class.crowd_base_url
106
+ end
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,51 @@
1
+ module AuthlogicCrowdRest
2
+ # A class for describing the current version of a library. The version
3
+ # consists of three parts: the +major+ number, the +minor+ number, and the
4
+ # +tiny+ (or +patch+) number.
5
+ class Version
6
+ include Comparable
7
+
8
+ # A convenience method for instantiating a new Version instance with the
9
+ # given +major+, +minor+, and +tiny+ components.
10
+ def self.[](major, minor, tiny)
11
+ new(major, minor, tiny)
12
+ end
13
+
14
+ attr_reader :major, :minor, :tiny
15
+
16
+ # Create a new Version object with the given components.
17
+ def initialize(major, minor, tiny)
18
+ @major, @minor, @tiny = major, minor, tiny
19
+ end
20
+
21
+ # Compare this version to the given +version+ object.
22
+ def <=>(version)
23
+ to_i <=> version.to_i
24
+ end
25
+
26
+ # Converts this version object to a string, where each of the three
27
+ # version components are joined by the '.' character. E.g., 2.0.0.
28
+ def to_s
29
+ @to_s ||= [@major, @minor, @tiny].join(".")
30
+ end
31
+
32
+ # Converts this version to a canonical integer that may be compared
33
+ # against other version objects.
34
+ def to_i
35
+ @to_i ||= @major * 1_000_000 + @minor * 1_000 + @tiny
36
+ end
37
+
38
+ def to_a
39
+ [@major, @minor, @tiny]
40
+ end
41
+
42
+ MAJOR = 2
43
+ MINOR = 0
44
+ TINY = 0
45
+
46
+ # The current version as a Version instance
47
+ CURRENT = new(MAJOR, MINOR, TINY)
48
+ # The current version as a String
49
+ STRING = CURRENT.to_s
50
+ end
51
+ end
@@ -0,0 +1,6 @@
1
+ require "authlogic_crowd_rest/version"
2
+ require "authlogic_crowd_rest/acts_as_authentic"
3
+ require "authlogic_crowd_rest/session"
4
+
5
+ ActiveRecord::Base.send(:include, AuthlogicCrowdRest::ActsAsAuthentic)
6
+ Authlogic::Session::Base.send(:include, AuthlogicCrowdRest::Session)
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class ActsAsAuthenticTest < ActiveSupport::TestCase
4
+ def test_included
5
+ assert User.send(:acts_as_authentic_modules).include?(AuthlogicCrowdRest::ActsAsAuthentic::Methods)
6
+ end
7
+ end
data/test/libs/user.rb ADDED
@@ -0,0 +1,3 @@
1
+ class User < ActiveRecord::Base
2
+ acts_as_authentic
3
+ end
@@ -0,0 +1,2 @@
1
+ class UserSession < Authlogic::Session::Base
2
+ end
@@ -0,0 +1,45 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class SessionTest < ActiveSupport::TestCase
4
+ setup :setup_http_stubs, :setup_users
5
+
6
+ def setup_http_stubs
7
+ stub_request(:post, "http://example:bogus@localhost/crowd/console?username=ben").
8
+ with(:body => "<password><value>benrocks</value></password>",
9
+ :headers => {'Accept'=>'*/*', 'Content-Type'=>'text/xml'}).
10
+ to_return(:status => 200, :body => %q[<?xml version="1.0" encoding="UTF-8" standalone="yes"?><user name="ben" expand="attributes"><link rel="self" href="http://localhost/crowd/rest/usermanagement/latest/user?username=ben"/><first-name>Ben</first-name><last-name>Johnson</last-name><display-name>Rob Dimarco</display-name><email>ben@foo.com</email><password><link rel="edit" href="http://localhost/crowd/rest/usermanagement/latest/user/password?username=ben"/></password><active>true</active><attributes><link rel="self" href="http://localhost/crowd/rest/usermanagement/latest/user/attribute?username=ben"/></attributes></user>], :headers => {})
11
+
12
+ stub_request(:post, "http://example:bogus@localhost/crowd/console?username=ben").
13
+ with(:body => "<password><value>bogus</value></password>",
14
+ :headers => {'Accept'=>'*/*', 'Content-Type'=>'text/xml'}).
15
+ to_return(:status => 400, :body => %q[Incorrect], :headers => {})
16
+ end
17
+
18
+ def setup_users
19
+ User.find_or_create_by_login :login=>"ben", :email=>"foo@bar.com", :password=>"benrocks", :password_confirmation => "benrocks"
20
+ end
21
+
22
+ def test_use_crowd_rest_authentication
23
+ assert_not_nil User.find_by_login 'ben'
24
+
25
+ UserSession.crowd_base_url = "http://localhost/crowd/console"
26
+ UserSession.crowd_application_name = "example"
27
+ UserSession.crowd_application_password = "bogus"
28
+
29
+ session = UserSession.new(:login => 'ben', :password => "benrocks")
30
+
31
+ assert session.save
32
+ end
33
+
34
+ def test_invalid_password
35
+ assert_not_nil User.find_by_login 'ben'
36
+ UserSession.crowd_base_url = "http://localhost/crowd/console"
37
+ UserSession.crowd_application_name = "example"
38
+ UserSession.crowd_application_password = "bogus"
39
+
40
+ session = UserSession.new(:login => 'ben', :password => "bogus")
41
+
42
+ assert !session.save
43
+ assert_equal ["Password is not valid"], session.errors.full_messages
44
+ end
45
+ end
@@ -0,0 +1,59 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+
12
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+
15
+ require 'active_record'
16
+ require 'authlogic'
17
+ require 'authlogic_crowd_rest'
18
+ require 'webmock/test_unit'
19
+ require 'logger'
20
+
21
+
22
+ ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
23
+ ActiveRecord::Base.configurations = true
24
+ if ENV['VERBOSE'] == "true"
25
+ ActiveRecord::Schema.verbose = true
26
+ ActiveRecord::Base.logger = Logger.new(STDOUT)
27
+ else
28
+ ActiveRecord::Schema.verbose = false
29
+ end
30
+ ActiveRecord::Schema.define(:version => 1) do
31
+ create_table :users do |t|
32
+ t.datetime :created_at
33
+ t.datetime :updated_at
34
+ t.integer :lock_version, :default => 0
35
+ t.string :login
36
+ t.string :crypted_password
37
+ t.string :password_salt
38
+ t.string :persistence_token
39
+ t.string :single_access_token
40
+ t.string :perishable_token
41
+ t.string :email
42
+ t.string :first_name
43
+ t.string :last_name
44
+ t.integer :login_count, :default => 0, :null => false
45
+ t.integer :failed_login_count, :default => 0, :null => false
46
+ t.datetime :last_request_at
47
+ t.datetime :current_login_at
48
+ t.datetime :last_login_at
49
+ t.string :current_login_ip
50
+ t.string :last_login_ip
51
+ end
52
+ end
53
+
54
+ require File.dirname(__FILE__) + '/libs/user'
55
+ require File.dirname(__FILE__) + '/libs/user_session'
56
+ require 'authlogic/test_case'
57
+ class ActiveSupport::TestCase
58
+ setup :activate_authlogic
59
+ end
metadata ADDED
@@ -0,0 +1,204 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: authlogic_crowd_rest
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Rob Di Marco
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-02-26 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ type: :runtime
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ name: authlogic
33
+ version_requirements: *id001
34
+ prerelease: false
35
+ - !ruby/object:Gem::Dependency
36
+ type: :development
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ hash: 23
43
+ segments:
44
+ - 1
45
+ - 0
46
+ - 0
47
+ version: 1.0.0
48
+ name: bundler
49
+ version_requirements: *id002
50
+ prerelease: false
51
+ - !ruby/object:Gem::Dependency
52
+ type: :development
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ hash: 7
59
+ segments:
60
+ - 1
61
+ - 5
62
+ - 2
63
+ version: 1.5.2
64
+ name: jeweler
65
+ version_requirements: *id003
66
+ prerelease: false
67
+ - !ruby/object:Gem::Dependency
68
+ type: :development
69
+ requirement: &id004 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ name: rcov
79
+ version_requirements: *id004
80
+ prerelease: false
81
+ - !ruby/object:Gem::Dependency
82
+ type: :development
83
+ requirement: &id005 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ hash: 3
89
+ segments:
90
+ - 0
91
+ version: "0"
92
+ name: actionpack
93
+ version_requirements: *id005
94
+ prerelease: false
95
+ - !ruby/object:Gem::Dependency
96
+ type: :development
97
+ requirement: &id006 !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ hash: 3
103
+ segments:
104
+ - 0
105
+ version: "0"
106
+ name: activerecord
107
+ version_requirements: *id006
108
+ prerelease: false
109
+ - !ruby/object:Gem::Dependency
110
+ type: :development
111
+ requirement: &id007 !ruby/object:Gem::Requirement
112
+ none: false
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ hash: 3
117
+ segments:
118
+ - 0
119
+ version: "0"
120
+ name: sqlite3
121
+ version_requirements: *id007
122
+ prerelease: false
123
+ - !ruby/object:Gem::Dependency
124
+ type: :development
125
+ requirement: &id008 !ruby/object:Gem::Requirement
126
+ none: false
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ hash: 3
131
+ segments:
132
+ - 0
133
+ version: "0"
134
+ name: webmock
135
+ version_requirements: *id008
136
+ prerelease: false
137
+ description: Foo
138
+ email: rob.dimarco@416software.com
139
+ executables: []
140
+
141
+ extensions: []
142
+
143
+ extra_rdoc_files:
144
+ - LICENSE.txt
145
+ - README.rdoc
146
+ files:
147
+ - .document
148
+ - Gemfile
149
+ - Gemfile.lock
150
+ - LICENSE.txt
151
+ - MIT-LICENSE
152
+ - README.rdoc
153
+ - Rakefile
154
+ - VERSION
155
+ - authlogic_crowd_rest.gemspec
156
+ - lib/authlogic_crowd_rest.rb
157
+ - lib/authlogic_crowd_rest/acts_as_authentic.rb
158
+ - lib/authlogic_crowd_rest/session.rb
159
+ - lib/authlogic_crowd_rest/version.rb
160
+ - test/acts_as_authentic_test.rb
161
+ - test/libs/user.rb
162
+ - test/libs/user_session.rb
163
+ - test/session_test.rb
164
+ - test/test_helper.rb
165
+ has_rdoc: true
166
+ homepage: http://github.com/robdimarco/authlogic_crowd_rest
167
+ licenses:
168
+ - MIT
169
+ post_install_message:
170
+ rdoc_options: []
171
+
172
+ require_paths:
173
+ - lib
174
+ required_ruby_version: !ruby/object:Gem::Requirement
175
+ none: false
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ hash: 3
180
+ segments:
181
+ - 0
182
+ version: "0"
183
+ required_rubygems_version: !ruby/object:Gem::Requirement
184
+ none: false
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ hash: 3
189
+ segments:
190
+ - 0
191
+ version: "0"
192
+ requirements: []
193
+
194
+ rubyforge_project:
195
+ rubygems_version: 1.5.2
196
+ signing_key:
197
+ specification_version: 3
198
+ summary: An Authlogic plugin to connect with Atlassian Crowd REST APIs
199
+ test_files:
200
+ - test/acts_as_authentic_test.rb
201
+ - test/libs/user.rb
202
+ - test/libs/user_session.rb
203
+ - test/session_test.rb
204
+ - test/test_helper.rb