crowd 0.5.0 → 0.5.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.
@@ -1,5 +1,9 @@
1
- == 0.5.0 / 2007-10-21
1
+ == 0.5.2 / 2007-10-24
2
2
 
3
+ * 0.5.2
4
+ * Fixed an uncaught exception when finding a user by an expired token.
5
+ * 0.5.1
6
+ * Added invalidate_principal_token
3
7
  * 0.5.0
4
8
  * Allow application to re-authenticate if token is invalid.
5
9
  * Refactored all methods to reduce code and generalize exception handling.
@@ -2,11 +2,11 @@ History.txt
2
2
  Manifest.txt
3
3
  README.txt
4
4
  Rakefile
5
- lib/SecurityServerClient.rb
6
- lib/crowd-1.1.0.wsdl
7
5
  lib/crowd.rb
6
+ lib/crowd/crowd-1.1.0.wsdl
7
+ lib/crowd/default.rb
8
+ lib/crowd/defaultDriver.rb
9
+ lib/crowd/defaultMappingRegistry.rb
10
+ lib/crowd/SecurityServerClient.rb
8
11
  lib/crowd/version.rb
9
- lib/default.rb
10
- lib/defaultDriver.rb
11
- lib/defaultMappingRegistry.rb
12
12
  test/test_crowd.rb
data/README.txt CHANGED
@@ -1,4 +1,4 @@
1
- crowd
1
+ = crowd
2
2
  by Jason Rimmer (jrimmer@irth.net) & gemified by Daniel Morrison (http://collectiveidea.com)
3
3
 
4
4
  == DESCRIPTION:
@@ -8,38 +8,31 @@ A client for Atlassian Crowd v1.1.0r2.
8
8
  Notes:
9
9
  WSDL stub generated with wsdl2ruby.rb --wsdl http://localhost:8095/crowd/services/SecurityServer?wsdl --type client
10
10
 
11
- Files:
12
- default.rb - Generated
13
- defaultDriver.rb - Generated
14
- defaultMappingRegistry - Generated
15
- README - You're soaking in it
16
- SecurityServerClient.rb - Generated
17
- crowd.rb - Class wrapping crowd calls
18
- test_crowd.rb - Unit tests
19
-
20
-
21
11
  == FEATURES:
22
12
 
23
13
  Methods exercised:
24
- authenticatePrincipal
25
- addPrincipal
26
- findPrincipalByName
27
- findPrincipalByToken
28
- removeAttributeFromPrincipal
29
- addAttributeToPrincipal
30
- updatePrincipalAttribute
31
- removePrincipal
32
- findAllPrincipalNames
33
- findAllRoleNames
34
- addRole
35
- addPrincipalToRole
36
- removePrincipalFromRole
37
- isRoleMember
38
- removeRole
14
+
15
+ * authenticatePrincipal
16
+ * addPrincipal
17
+ * findPrincipalByName
18
+ * findPrincipalByToken
19
+ * removeAttributeFromPrincipal
20
+ * addAttributeToPrincipal
21
+ * updatePrincipalAttribute
22
+ * removePrincipal
23
+ * findAllPrincipalNames
24
+ * findAllRoleNames
25
+ * addRole
26
+ * addPrincipalToRole
27
+ * removePrincipalFromRole
28
+ * isRoleMember
29
+ * removeRole
30
+ * invalidatePrincipalToken
39
31
 
40
32
  Assumptions (configured in CrowdTest.rb):
41
- Application name and password is 'soaptest'
42
- Crowd Server is on localhost
33
+
34
+ * Application name and password is 'soaptest'
35
+ * Crowd Server is on localhost
43
36
 
44
37
  == TODO:
45
38
 
@@ -48,7 +41,7 @@ Create Rails plugin
48
41
 
49
42
  == SYNOPSIS:
50
43
 
51
- Ruby client for Atlassian Crowd v1.1.0r2
44
+ Ruby client for Atlassian Crowd v1.1.0r2
52
45
 
53
46
  == REQUIREMENTS:
54
47
 
@@ -59,6 +52,16 @@ Create Rails plugin
59
52
 
60
53
  * sudo gem install crowd
61
54
 
55
+ == FILES:
56
+
57
+ * default.rb - Generated
58
+ * defaultDriver.rb - Generated
59
+ * defaultMappingRegistry - Generated
60
+ * README - You're soaking in it
61
+ * SecurityServerClient.rb - Generated
62
+ * crowd.rb - Class wrapping crowd calls
63
+ * test_crowd.rb - Unit tests
64
+
62
65
  == LICENSE:
63
66
 
64
67
  Public Domain
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env ruby
2
-
3
1
  #
4
2
  # Created by Jason Rimmer, jrimmer@irth.net on 2007-10-16.
5
3
  # I hereby place this work that I have authored into the public domain
@@ -8,7 +6,7 @@
8
6
  require 'rubygems'
9
7
  gem 'soap4r'
10
8
 
11
- require File.join(File.dirname(__FILE__), 'defaultDriver.rb')
9
+ require File.join(File.dirname(__FILE__), 'crowd', 'defaultDriver.rb')
12
10
  require 'crowd/version'
13
11
 
14
12
  #
@@ -171,7 +169,6 @@ class Crowd
171
169
  arg = FindPrincipalByToken.new(@@application_token, token)
172
170
  server.findPrincipalByToken(arg)
173
171
  end
174
-
175
172
  case response
176
173
  when FindPrincipalByTokenResponse
177
174
  return parse_principal(response.out)
@@ -180,6 +177,25 @@ class Crowd
180
177
  else
181
178
  raise AuthenticationException, response
182
179
  end
180
+ rescue SOAP::FaultError => e
181
+ raise AuthenticationException, e.message
182
+ end
183
+
184
+
185
+ ##
186
+ # Invalidate Principal Token
187
+ def self.invalidate_principal_token(token)
188
+ response = authenticated_connection do
189
+ arg = InvalidatePrincipalToken.new(@@application_token, token)
190
+ server.invalidatePrincipalToken(arg)
191
+ end
192
+
193
+ case response
194
+ when InvalidatePrincipalTokenResponse
195
+ return true
196
+ else
197
+ raise AuthenticationException, response
198
+ end
183
199
  end
184
200
 
185
201
  ##
@@ -488,7 +504,7 @@ class Crowd
488
504
  raise AuthenticationConnectionException
489
505
  rescue SOAP::FaultError => e
490
506
  # If the application token is invalid/expired, we'll give it one more shot.
491
- if e.message =~ /Invalid application client/
507
+ if e.message.include?('Invalid application client')
492
508
  authenticate_application
493
509
  response = yield
494
510
  else
@@ -498,7 +514,7 @@ class Crowd
498
514
  end
499
515
  rescue Exception
500
516
  raise AuthenticationException, response
501
-
517
+ ensure
502
518
  if response.is_a?(InvalidAuthorizationTokenException)
503
519
  authenticate_application
504
520
  response = yield
File without changes
@@ -2,7 +2,7 @@ class Crowd #:nodoc:
2
2
  module Version #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 5
5
- TINY = 0
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: crowd
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.5.0
7
- date: 2007-10-21 00:00:00 -04:00
6
+ version: 0.5.2
7
+ date: 2007-11-02 00:00:00 -04:00
8
8
  summary: Ruby client for Atlassian Crowd
9
9
  require_paths:
10
10
  - lib
11
11
  email: jrimmer@irth.net
12
12
  homepage: http://crowd.rubyforge.org
13
13
  rubyforge_project: crowd
14
- description: "A client for Atlassian Crowd v1.1.0r2. Notes: WSDL stub generated with wsdl2ruby.rb --wsdl http://localhost:8095/crowd/services/SecurityServer?wsdl --type client Files: default.rb - Generated defaultDriver.rb - Generated defaultMappingRegistry - Generated README - You're soaking in it SecurityServerClient.rb - Generated crowd.rb - Class wrapping crowd calls test_crowd.rb - Unit tests == FEATURES: Methods exercised: authenticatePrincipal addPrincipal findPrincipalByName findPrincipalByToken removeAttributeFromPrincipal addAttributeToPrincipal updatePrincipalAttribute removePrincipal findAllPrincipalNames findAllRoleNames addRole addPrincipalToRole removePrincipalFromRole isRoleMember removeRole"
14
+ description: "A client for Atlassian Crowd v1.1.0r2. Notes: WSDL stub generated with wsdl2ruby.rb --wsdl http://localhost:8095/crowd/services/SecurityServer?wsdl --type client == FEATURES: Methods exercised: * authenticatePrincipal * addPrincipal * findPrincipalByName * findPrincipalByToken * removeAttributeFromPrincipal * addAttributeToPrincipal * updatePrincipalAttribute * removePrincipal * findAllPrincipalNames * findAllRoleNames * addRole * addPrincipalToRole * removePrincipalFromRole * isRoleMember * removeRole * invalidatePrincipalToken"
15
15
  autorequire:
16
16
  default_executable:
17
17
  bindir: bin
@@ -33,13 +33,13 @@ files:
33
33
  - Manifest.txt
34
34
  - README.txt
35
35
  - Rakefile
36
- - lib/SecurityServerClient.rb
37
- - lib/crowd-1.1.0.wsdl
38
36
  - lib/crowd.rb
37
+ - lib/crowd/crowd-1.1.0.wsdl
38
+ - lib/crowd/default.rb
39
+ - lib/crowd/defaultDriver.rb
40
+ - lib/crowd/defaultMappingRegistry.rb
41
+ - lib/crowd/SecurityServerClient.rb
39
42
  - lib/crowd/version.rb
40
- - lib/default.rb
41
- - lib/defaultDriver.rb
42
- - lib/defaultMappingRegistry.rb
43
43
  - test/test_crowd.rb
44
44
  test_files:
45
45
  - test/test_crowd.rb