rubycas-server 1.1.1 → 1.1.2

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # RubyCAS-Server ![http://stillmaintained.com/rubycas/rubycas-server](http://stillmaintained.com/rubycas/rubycas-server.png)
1
+ # RubyCAS-Server
2
2
 
3
3
  ## Copyright
4
4
 
@@ -11,9 +11,26 @@ See http://github.com/gunark/rubycas-server/commits/
11
11
 
12
12
  ## Installation
13
13
 
14
- See http://code.google.com/p/rubycas-server
14
+ 1. `git clone git://github.com/rubycas/rubycas-server.git`
15
+ 2. `cd rubycas-server`
16
+ 3. `cp config/config.example.yml config.yml`
17
+ 4. Customize your server by modifying the `config.yml` file. It is well commented but make sure that you take care of the following:
18
+ 1. Change the database driver to `mysql2`
19
+ 2. Configure at least one authenticator
20
+ 3. You might want to change `log.file` to something local, so that you don't need root. For example just `casserver.log`
21
+ 4. You might also want to disable SSL for now by commenting out the `ssl_cert` line and changing the port to something like `8888`
22
+ 5. Create the database (i.e. `mysqladmin -u root create casserver` or whatever you have in `config.yml`)
23
+ 6. Modify the existing Gemfile by adding drivers for your database server. For example, if you configured `mysql2` in config.yml, add this to the Gemfile: `gem "mysql2"` and `gem "activerecord-mysql2-adapter"`
24
+ 7. Run `bundle install`
25
+ 8. `bundle exec rubycas-server -c config.yml`
26
+
27
+ Your RubyCAS-Server should now be running. Once you've confirmed that everything looks good, try switching to a [Passenger](http://www.modrails.com/) deployment. You should be able to point Apache (or whatever) to the `rubycas-server/public` directory, and everything should just work.
28
+
29
+ Some more info is available at the [RubyCAS-Server Wiki](http://code.google.com/p/rubycas-server/w/list).
30
+
31
+ If you have questions, try the [RubyCAS Google Group](https://groups.google.com/forum/?fromgroups#!forum/rubycas-server).
15
32
 
16
33
  ## License
17
34
 
18
35
  RubyCAS-Server is licensed for use under the terms of the MIT License.
19
- See the LICENSE file bundled with the official RubyCAS-Server distribution for details.
36
+ See the LICENSE file bundled with the official RubyCAS-Server distribution for details.
data/config.ru CHANGED
@@ -1,11 +1,5 @@
1
1
  require 'rubygems'
2
-
3
- # Assume all necessary gems are in place if bundler is not installed.
4
- begin
5
- require 'bundler/setup'
6
- rescue LoadError => e
7
- raise e unless e.message =~ /no such file to load -- bundler/
8
- end
2
+ require 'bundler/setup'
9
3
 
10
4
  $:.unshift "#{File.dirname(__FILE__)}/lib"
11
5
  require "casserver"
@@ -78,24 +78,18 @@ class CASServer::Authenticators::SQL < CASServer::Authenticators::Base
78
78
  def validate(credentials)
79
79
  read_standard_credentials(credentials)
80
80
  raise_if_not_configured
81
-
82
- user_model = self.class.user_model
83
-
84
- username_column = @options[:username_column] || 'username'
85
- password_column = @options[:password_column] || 'password'
86
81
 
87
82
  $LOG.debug "#{self.class}: [#{user_model}] " + "Connection pool size: #{user_model.connection_pool.instance_variable_get(:@checked_out).length}/#{user_model.connection_pool.instance_variable_get(:@connections).length}"
88
- results = user_model.find(:all, :conditions => ["#{username_column} = ? AND #{password_column} = ?", @username, @password])
89
83
  user_model.connection_pool.checkin(user_model.connection)
90
84
 
91
- if results.size > 0
92
- $LOG.warn("#{self.class}: Multiple matches found for user #{@username.inspect}") if results.size > 1
85
+ if matching_users.size > 0
86
+ $LOG.warn("#{self.class}: Multiple matches found for user #{@username.inspect}") if matching_users.size > 1
93
87
 
94
88
  unless @options[:extra_attributes].blank?
95
- if results.size > 1
89
+ if matching_users.size > 1
96
90
  $LOG.warn("#{self.class}: Unable to extract extra_attributes because multiple matches were found for #{@username.inspect}")
97
91
  else
98
- user = results.first
92
+ user = matching_users.first
99
93
 
100
94
  extract_extra(user)
101
95
  log_extra
@@ -110,6 +104,18 @@ class CASServer::Authenticators::SQL < CASServer::Authenticators::Base
110
104
 
111
105
  protected
112
106
 
107
+ def user_model
108
+ self.class.user_model
109
+ end
110
+
111
+ def username_column
112
+ @options[:username_column] || 'username'
113
+ end
114
+
115
+ def password_column
116
+ @options[:password_column] || 'password'
117
+ end
118
+
113
119
  def raise_if_not_configured
114
120
  raise CASServer::AuthenticatorError.new(
115
121
  "Cannot validate credentials because the authenticator hasn't yet been configured"
@@ -130,4 +136,8 @@ class CASServer::Authenticators::SQL < CASServer::Authenticators::Base
130
136
  $LOG.debug("#{self.class}: Read the following extra_attributes for user #{@username.inspect}: #{@extra_attributes.inspect}")
131
137
  end
132
138
  end
139
+
140
+ def matching_users
141
+ user_model.find(:all, :conditions => ["#{username_column} = ? AND #{password_column} = ?", @username, @password])
142
+ end
133
143
  end
@@ -0,0 +1,17 @@
1
+ require 'casserver/authenticators/sql'
2
+
3
+ require 'bcrypt'
4
+
5
+ # Essentially the same as the standard SQL authenticator but assumes that
6
+ # BCrypt has been used to encrypt the password. If you're using
7
+ # has_secure_password, then this is probably for you.
8
+ class CASServer::Authenticators::SQLBcrypt < CASServer::Authenticators::SQL
9
+
10
+ protected
11
+
12
+ def matching_users
13
+ results = user_model.find(:all, :conditions => ["#{username_column} = ?", @username])
14
+ results.select { |user| BCrypt::Password.new(user.send(password_column.to_sym)) == @password }
15
+ end
16
+
17
+ end
@@ -5,8 +5,8 @@ module CASServer
5
5
  def self.included(mod)
6
6
  mod.module_eval do
7
7
  register Sinatra::R18n
8
- set :default_locale, 'en'
9
- set :translations, File.dirname(__FILE__) + "/../../locales"
8
+ R18n::I18n.default = 'en'
9
+ R18n.default_places { File.expand_path(File.join(File.dirname(__FILE__),'..','..','locales')) }
10
10
  end
11
11
  end
12
12
  end
@@ -1,6 +1,6 @@
1
1
  $gemspec = Gem::Specification.new do |s|
2
2
  s.name = 'rubycas-server'
3
- s.version = '1.1.1'
3
+ s.version = '1.1.2'
4
4
  s.authors = ["Matt Zukowski"]
5
5
  s.email = ["matt@zukowski.ca"]
6
6
  s.homepage = 'https://github.com/rubycas/rubycas-server'
@@ -32,7 +32,7 @@ For more information on RubyCAS-Server, see http://code.google.com/p/rubycas-ser
32
32
  s.add_dependency("activerecord", ">= 2.3.12", "< 3.1")
33
33
  s.add_dependency("activesupport", ">= 2.3.12", "< 3.1")
34
34
  s.add_dependency("sinatra", "~> 1.0")
35
- s.add_dependency("sinatra-r18n")
35
+ s.add_dependency("sinatra-r18n", '~> 1.1.0')
36
36
  s.add_dependency("crypt-isaac", "~> 0.9.1")
37
37
 
38
38
  s.add_development_dependency("rack-test")
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubycas-server
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 1
10
- version: 1.1.1
9
+ - 2
10
+ version: 1.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Zukowski
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-06-08 00:00:00 Z
18
+ date: 2012-09-19 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activerecord
@@ -84,12 +84,14 @@ dependencies:
84
84
  requirement: &id004 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
- - - ">="
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
- hash: 3
89
+ hash: 19
90
90
  segments:
91
+ - 1
92
+ - 1
91
93
  - 0
92
- version: "0"
94
+ version: 1.1.0
93
95
  type: :runtime
94
96
  version_requirements: *id004
95
97
  - !ruby/object:Gem::Dependency
@@ -275,6 +277,7 @@ files:
275
277
  - lib/casserver/authenticators/sql.rb
276
278
  - lib/casserver/authenticators/sql_encrypted.rb
277
279
  - lib/casserver/authenticators/sql_authlogic.rb
280
+ - lib/casserver/authenticators/sql_bcrypt.rb
278
281
  - lib/casserver/authenticators/google.rb
279
282
  - lib/casserver/authenticators/base.rb
280
283
  - lib/casserver/authenticators/ntlm.rb