sixarm_ruby_password_attribute 1.5.8

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.tar.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ ��� �
2
+ g[Fb$�����������! 6�yHP�<�� �I�&���`3���`s���k-j�6���{�x��әfk� @��G�þ�AF�w3�1�`}{ʲ]y»�O�W�
data/.gemtest ADDED
File without changes
data/CHANGELOG.txt ADDED
@@ -0,0 +1,6 @@
1
+ CHANGELOG
2
+
3
+ 2011-04-19 1.5.8 Add password_before_type_cast
4
+ 2011-04-19 1.5.6 Bump dependency on ActiveRecordMock
5
+ 2011-04-19 1.5.4 Bump dependency on ActiveRecordMock
6
+ 2011-04-18 1.5.2 Update to Ruby 1.9.2 and Rails 3.0.5
data/INSTALL.txt ADDED
@@ -0,0 +1,32 @@
1
+
2
+ = SixArm.com Ruby Gem Install
3
+
4
+
5
+ First-time users: add our gem certificate and source.
6
+ When you do this once, it works for all our gems.
7
+
8
+ sudo wget http://sixarm.com/sixarm.pem
9
+ sudo gem cert --add sixarm.pem
10
+ sudo gem sources --add http://sixarm.com
11
+
12
+ Install the gem with advanced options.
13
+
14
+ sudo gem install sixarm_ruby_password_attribute --test --trust-policy HighSecurity
15
+
16
+
17
+ == Notes
18
+
19
+ Do you have any questions, comments, suggestions, or feedback?
20
+ Let us know, we're happy to help. Our email is sixarm@sixarm.com
21
+
22
+ Do you want to create your own high security gems?
23
+ Learn how at http://www.rubygems.org/read/chapter/21
24
+
25
+ To see your current gem certificate list:
26
+
27
+ sudo gem cert --list
28
+
29
+ Our cert looks like this:
30
+
31
+ /C=US/ST=California/L=San Francisco/O=SixArm/CN=sixarm.com
32
+
data/LICENSE.txt ADDED
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+
3
+ You may choose any of these licenses:
4
+
5
+ - CreativeCommons License, Non-commercial Share Alike
6
+ - LGPL, GNU Lesser General Public License
7
+ - MIT License
8
+ - Ruby License
9
+
10
+ THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
11
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
12
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
data/README.rdoc ADDED
@@ -0,0 +1,36 @@
1
+ = SixArm.com » Ruby » PasswordAttribute module to add strong passwords to ActiveRecord
2
+
3
+ Author:: Joel Parker Henderson, joel@joelparkerhenderson.com
4
+ Copyright:: Copyright (c) 2006-2011 Joel Parker Henderson
5
+ License:: See LICENSE.txt file
6
+
7
+ Easy way to add BCrypt strong password capability to an ActiveRecord model.
8
+
9
+ This is typically useful to add to a Ruby On Rails ActiveRecord user model.
10
+
11
+ Example:
12
+ require 'sixarm_ruby_password_attribute'
13
+ class User
14
+ include PasswordAttribute
15
+ end
16
+
17
+ Example: create new user
18
+ user=User.new
19
+ user.password='secret' # automatically converts plain text to bcrypt
20
+ user.save
21
+
22
+ Example: is a user's password valid?
23
+ if user.password=='secret'
24
+ # password is valid
25
+ else
26
+ # password is invalid
27
+ end
28
+
29
+ u.password='secret'
30
+ => user's password is now secret
31
+
32
+ u.password=='secret'
33
+ => true
34
+
35
+ u.password=='xxx'
36
+ => false
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << 'lib' << 'test'
7
+ t.pattern = 'test/*.rb'
8
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.5.8
@@ -0,0 +1,25 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin rdoc
3
+ Please see README.rdoc
4
+ =end
5
+
6
+ require 'bcrypt'
7
+
8
+ module PasswordAttribute
9
+
10
+ # Read the :password attribute as a new BCrypt::Password.
11
+ # Return the BCrypt::Password.
12
+
13
+ def password
14
+ BCrypt::Password.new(password_before_type_cast)
15
+ end
16
+
17
+ # Write the :password attribute as a new BCrypt::Password.
18
+
19
+ def password=(plain_text)
20
+ write_attribute(:password,BCrypt::Password.create(plain_text))
21
+ end
22
+
23
+ end
24
+
25
+
@@ -0,0 +1,50 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'test/unit'
3
+ require 'sixarm_ruby_password_attribute'
4
+ require 'sixarm_ruby_active_record_mock'
5
+ require 'simplecov'
6
+ SimpleCov.start
7
+
8
+ class User < ActiveRecordMock
9
+ include PasswordAttribute
10
+ end
11
+
12
+ class Testing < Test::Unit::TestCase
13
+
14
+ def test_get_and_set
15
+ user=User.new
16
+ user.password='hello'
17
+ assert_not_nil(user.password,"user.password")
18
+ assert(user.password=='hello',"user.password=='hello'")
19
+ end
20
+
21
+ def test_encrypts_different_plaintext_to_different_crypttext
22
+ user1 = User.new
23
+ user2 = User.new
24
+ user1.password='hello'
25
+ user2.password='world'
26
+ assert_not_nil(user1.password,"user1.password")
27
+ assert_not_nil(user2.password,"user2.password")
28
+ assert_not_same(user1.password,user2.password,"user1.password,user2.pasword")
29
+ assert_not_equal(user1.password.to_s,user2.password.to_s,"user1.password.to_s,user2.pasword.to_s")
30
+ end
31
+
32
+ def test_gets_consistent_password_multiple_times
33
+ user = User.new
34
+ user.password='hello'
35
+ x=user.password
36
+ y=user.password
37
+ assert_not_nil(x,"user.password x")
38
+ assert_not_nil(y,"user.password y")
39
+ x=x.to_s
40
+ y=y.to_s
41
+ assert_not_nil(x,"user.password x to_s")
42
+ assert_not_nil(y,"user.password y to_s")
43
+ assert_equal(x,y,"user.password x to_s, user.password y to_s")
44
+ end
45
+
46
+ end
47
+
48
+
49
+
50
+
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sixarm_ruby_password_attribute
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 1.5.8
6
+ platform: ruby
7
+ authors:
8
+ - SixArm
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain:
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+ ZDRQYMqru9TEMna6HD9zpcstF7vwThGovlOQ+3Y6plQ4nMzipXcZ9THqs65PIL0q
30
+ eabwpCbAopo=
31
+ -----END CERTIFICATE-----
32
+
33
+ date: 2011-04-19 00:00:00 -07:00
34
+ default_executable:
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: bcrypt-ruby
38
+ prerelease: false
39
+ requirement: &id001 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 2.0.3
45
+ type: :runtime
46
+ version_requirements: *id001
47
+ - !ruby/object:Gem::Dependency
48
+ name: sixarm_ruby_active_record_mock
49
+ prerelease: false
50
+ requirement: &id002 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - "="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.4.2
56
+ type: :runtime
57
+ version_requirements: *id002
58
+ description:
59
+ email: sixarm@sixarm.com
60
+ executables: []
61
+
62
+ extensions: []
63
+
64
+ extra_rdoc_files: []
65
+
66
+ files:
67
+ - .gemtest
68
+ - CHANGELOG.txt
69
+ - INSTALL.txt
70
+ - LICENSE.txt
71
+ - Rakefile
72
+ - README.rdoc
73
+ - VERSION
74
+ - lib/sixarm_ruby_password_attribute.rb
75
+ - test/sixarm_ruby_password_attribute_test.rb
76
+ has_rdoc: true
77
+ homepage: http://sixarm.com/
78
+ licenses: []
79
+
80
+ post_install_message:
81
+ rdoc_options: []
82
+
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: "0"
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: "0"
97
+ requirements: []
98
+
99
+ rubyforge_project:
100
+ rubygems_version: 1.6.2
101
+ signing_key:
102
+ specification_version: 3
103
+ summary: "SixArm.com \xC2\xBB Ruby \xC2\xBB PasswordAttribute model to provides read/write for an ActiveRecord password attribute based on bcrypt"
104
+ test_files:
105
+ - test/sixarm_ruby_password_attribute_test.rb
metadata.gz.sig ADDED
@@ -0,0 +1,3 @@
1
+ p�4�F/�R'ݓ�n$Ȝ(�u���RH���LM�ɦ.�in��~#��*
2
+ �
3
+ ��8�3U��g82t�?�g�b�Z�