oracle_ebs_authentication 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +458 -0
- data/README.md +32 -0
- data/lib/oracle_ebs_authentication.rb +6 -0
- data/lib/oracle_ebs_authentication/authenticator.rb +25 -0
- data/lib/oracle_ebs_authentication/security.rb +2170 -0
- data/lib/oracle_ebs_authentication/version.rb +3 -0
- data/spec/authenticator_spec.rb +37 -0
- data/spec/security_spec.rb +94 -0
- data/spec/spec_helper.rb +7 -0
- metadata +151 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "Authenticator" do
|
4
|
+
before(:all) do
|
5
|
+
if DATABASE_NAME && DATABASE_USERNAME && DATABASE_PASSWORD
|
6
|
+
plsql.connect! DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME
|
7
|
+
else
|
8
|
+
raise "You need to specify DATABASE_NAME, DATABASE_USERNAME, DATABASE_PASSWORD"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
before(:each) do
|
13
|
+
@auth = OracleEbsAuthentication::Authenticator.new
|
14
|
+
@user = "SIMANRAI"
|
15
|
+
@password = "welcome1"
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#get_fnd_password" do
|
19
|
+
it "should get APPS password and validate user password" do
|
20
|
+
@auth.get_fnd_password(@user, @password).should_not be_nil
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should not get APPS password for non-existing user" do
|
24
|
+
@auth.get_fnd_password("XXX", @password).should be_nil
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should not get APPS password for wrong user password" do
|
28
|
+
@auth.get_fnd_password(@user, "XXX").should be_nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#validate_user_password" do
|
33
|
+
it "should validate user password for given user" do
|
34
|
+
@auth.validate_user_password(@user, @password).should be_true
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "Security" do
|
4
|
+
before(:each) do
|
5
|
+
@security = OracleEbsAuthentication::Security.new
|
6
|
+
end
|
7
|
+
|
8
|
+
it "new_check should return nil if second parameter has encrypt failed message" do
|
9
|
+
@security.new_check("XXX", "ZG_ENCRYPT_FAILED_XXX", true).should be_nil
|
10
|
+
end
|
11
|
+
|
12
|
+
it "y should return SHA digest" do
|
13
|
+
@security.y("user","password").unpack("H*")[0].should == "a79ae8a67c2c3976b82fd25995501524e41c41a129095d06882c4bf7b2c3b782"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "z should return hex reprezentation of string" do
|
17
|
+
@security.z("\xAA\xBB\xCC").should == "AABBCC"
|
18
|
+
@security.z("\x11\x22\x33\x44\x55\x66").should == "112233445566"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "a_ should return UTF-8 encoded string" do
|
22
|
+
@security.a_("ACEĀČĒaceāčē").should == "ACEĀČĒaceāčē"
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#decrypt and #check" do
|
26
|
+
before(:each) do
|
27
|
+
@user1 = "ITA_JLAX"
|
28
|
+
@password1 = "vaidava1"
|
29
|
+
@wrong_password1 = "vaidava2"
|
30
|
+
@efp1 = "ZG614D5255C458E576C7E554E62DEFC58ECB33A539100C23FA1089CFCD550CFAC2C4BE9EC42A331C09E0B47B6EB431452C8C"
|
31
|
+
@eup1 = "ZGE0E4F7E40CE4586F5765ECD4A0F33A2C0991484F97BBD33F2C32E0A94C307D747363C0DF9816300C896CB5EA1F5EBB33E5"
|
32
|
+
|
33
|
+
@user2 = "ITA_JLAX"
|
34
|
+
@password2 = "warcraft3"
|
35
|
+
@wrong_password2 = "vaidava2"
|
36
|
+
@efp2 = "ZGEC82B1AE4D61E0EAF260B10AD7D557C2469A7EC4E6C9CE3FD77B9C8CEC8AC18FD0EC46DF6D54F94DC602C0BA3F6662C9DF"
|
37
|
+
@eup2 = "ZG65C60DF02F55BCCC7BB09BD70C1636C016AA415D486072E671489C0432C3D0CCAF05A0D2DEE7E55E2277356A930145CBA7"
|
38
|
+
|
39
|
+
@user3 = "hrms"
|
40
|
+
@password3 = "welcome"
|
41
|
+
@wrong_password3 = "welcome1"
|
42
|
+
@efp3 = "ZGBC22FF536248A02DC4B4FFAF8CAA1BDFD5564526BBEA23323D67C9BF541291333192D3C89A0447BB6B92FA8C9D272FD67C"
|
43
|
+
|
44
|
+
# R12 case-sensitive passwords
|
45
|
+
@user4 = "TESTEBRI"
|
46
|
+
@password4 = "R12tester"
|
47
|
+
@wrong_password4 = "R12TESTER"
|
48
|
+
@efp4 = "ZH6E999CDE99A952A00270CD7DAAEF1392CF1FBC6CFD6AB68EE970FFCEDEC3B88594B0E2A22AD5948B96BDA9B37F246E489C"
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should check user1 password" do
|
52
|
+
@security.check(@user1.upcase + "/" + @password1.upcase, @efp1, false).should be_true
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should not check user1 wrong password" do
|
56
|
+
@security.check(@user1.upcase + "/" + @wrong_password1.upcase, @efp1, false).should_not be_true
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should compare user1 password with decrypted" do
|
60
|
+
apps_password = @security.decrypt(@user1.upcase + "/" + @password1.upcase, @efp1, false)
|
61
|
+
# puts "</br>DEBUG: apps_password=#{apps_password}"
|
62
|
+
@security.decrypt(apps_password, @eup1, false).should == @password1.upcase
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should check user2 password" do
|
66
|
+
@security.check(@user2.upcase + "/" + @password2.upcase, @efp2, false).should be_true
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should not check user2 wrong password" do
|
70
|
+
@security.check(@user2.upcase + "/" + @wrong_password2.upcase, @efp2, false).should_not be_true
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should compare user2 password with decrypted" do
|
74
|
+
apps_password = @security.decrypt(@user2.upcase + "/" + @password2.upcase, @efp2, false)
|
75
|
+
@security.decrypt(apps_password, @eup2, false).should == @password2.upcase
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should check user3 password" do
|
79
|
+
@security.check(@user3.upcase + "/" + @password3.upcase, @efp3, false).should be_true
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should not check user3 wrong password" do
|
83
|
+
@security.check(@user3.upcase + "/" + @wrong_password3.upcase, @efp3, false).should_not be_true
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should check user4 password" do
|
87
|
+
@security.check(@user4.upcase + "/" + @password4, @efp4, false).should be_true
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should not check user4 wrong password" do
|
91
|
+
@security.check(@user4.upcase + "/" + @wrong_password4, @efp4, false).should_not be_true
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: oracle_ebs_authentication
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Edgars Beigarts
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-03-09 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: activesupport
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 7
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 2
|
33
|
+
version: "2.2"
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: ruby-plsql
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 11
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
- 4
|
48
|
+
- 2
|
49
|
+
version: 0.4.2
|
50
|
+
type: :runtime
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: rake
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
64
|
+
type: :development
|
65
|
+
version_requirements: *id003
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: rspec
|
68
|
+
prerelease: false
|
69
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ~>
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 27
|
75
|
+
segments:
|
76
|
+
- 2
|
77
|
+
- 5
|
78
|
+
- 0
|
79
|
+
version: 2.5.0
|
80
|
+
type: :development
|
81
|
+
version_requirements: *id004
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: ruby-oci8
|
84
|
+
prerelease: false
|
85
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ~>
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 7
|
91
|
+
segments:
|
92
|
+
- 2
|
93
|
+
- 0
|
94
|
+
- 4
|
95
|
+
version: 2.0.4
|
96
|
+
type: :development
|
97
|
+
version_requirements: *id005
|
98
|
+
description: This plugin provides Oracle E-Business Suite user authentication functionality.
|
99
|
+
email: 1@wb4.lv
|
100
|
+
executables: []
|
101
|
+
|
102
|
+
extensions: []
|
103
|
+
|
104
|
+
extra_rdoc_files: []
|
105
|
+
|
106
|
+
files:
|
107
|
+
- lib/oracle_ebs_authentication/authenticator.rb
|
108
|
+
- lib/oracle_ebs_authentication/security.rb
|
109
|
+
- lib/oracle_ebs_authentication/version.rb
|
110
|
+
- lib/oracle_ebs_authentication.rb
|
111
|
+
- spec/authenticator_spec.rb
|
112
|
+
- spec/security_spec.rb
|
113
|
+
- spec/spec_helper.rb
|
114
|
+
- README.md
|
115
|
+
- LICENSE
|
116
|
+
has_rdoc: true
|
117
|
+
homepage: http://github.com/ebeigarts/oracle_ebs_authentication
|
118
|
+
licenses: []
|
119
|
+
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
|
123
|
+
require_paths:
|
124
|
+
- lib
|
125
|
+
required_ruby_version: !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
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
none: false
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
hash: 3
|
140
|
+
segments:
|
141
|
+
- 0
|
142
|
+
version: "0"
|
143
|
+
requirements: []
|
144
|
+
|
145
|
+
rubyforge_project:
|
146
|
+
rubygems_version: 1.5.2
|
147
|
+
signing_key:
|
148
|
+
specification_version: 3
|
149
|
+
summary: This plugin provides Oracle E-Business Suite user authentication functionality.
|
150
|
+
test_files: []
|
151
|
+
|