crowd-stefanwille 0.5.8 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,26 +1,26 @@
1
1
  = crowd
2
- updated by Stefan Wille <post@stefanwille.com>
3
- updated by Olli Helenius <liff@iki.fi>
4
- updated by Evgeny Zislis (evgeny.zislis@gmail.com)
5
- original by Jason Rimmer (jrimmer@irth.net) & gemified for rubyforge by Daniel Morrison (http://collectiveidea.com)
6
-
7
- == DESCRIPTION:
8
2
 
9
3
  A client for Atlassian[http://www.atlassian.com] Crowd[http://www.atlassian.com/crowd] v2.0.5
10
4
 
11
- === NOTES:
12
- WSDL stub generated with:
13
- rake wsdl2ruby
14
-
15
- RSpec tests run with:
16
- rake test
17
- (requires a Crowd server on localhost, easy to setup)
18
-
19
- Local gem installed with:
20
- rake install
21
-
5
+ == INSTALL:
22
6
 
23
- Original SOAP API is available from Atlassian at http://confluence.atlassian.com/display/CROWDDEV/SOAP+API
7
+ sudo gem install crowd-stefanwille
8
+
9
+ == REQUIREMENTS:
10
+
11
+ * Ruby v1.8.6
12
+ * soap4r[http://dev.ctor.org/soap4r] v1.5.8
13
+ * Atlassian Crowd[http://atlassian.com/crowd] v2.0
14
+
15
+ == USE:
16
+
17
+ See demo/crowd_demo.rb and spec/crowd_spec.rb.
18
+
19
+ Assumptions (used in demo/crowd_demo.rb and spec/crowd_spec.rb):
20
+
21
+ * Crowd Server is on localhost, port 8095
22
+ * Application name and password is 'soaptest'
23
+ * Application 'soaptest' directory set to 'True'
24
24
 
25
25
  == FEATURES:
26
26
 
@@ -69,11 +69,19 @@ Methods exercised (*implemented*, not implemented):
69
69
 
70
70
  Role related methods were left in the Ruby API but are not tested. Roles are deprecated in favor of groups in Crowd 2.0
71
71
 
72
- Assumptions (configured in CrowdTest.rb):
72
+ === NOTES:
73
+ WSDL stub generated with:
74
+ rake wsdl2ruby
75
+
76
+ RSpec tests run with:
77
+ rake test
78
+ (requires a Crowd server on localhost, easy to setup)
79
+
80
+ Local gem installed with:
81
+ rake install
82
+
73
83
 
74
- * Crowd Server is on localhost, port 8095
75
- * Application name and password is 'soaptest'
76
- * Application 'soaptest' directory set to 'True'
84
+ Original SOAP API is available from Atlassian at http://confluence.atlassian.com/display/CROWDDEV/SOAP+API
77
85
 
78
86
  == TODO:
79
87
 
@@ -84,16 +92,6 @@ Assumptions (configured in CrowdTest.rb):
84
92
 
85
93
  Ruby client for Atlassian Crowd 2.0.5
86
94
 
87
- == REQUIREMENTS:
88
-
89
- * Ruby v1.8.6
90
- * soap4r[http://dev.ctor.org/soap4r] v1.5.8
91
- * Atlassian Crowd[http://atlassian.com/crowd] v2.0
92
-
93
- == INSTALL:
94
-
95
- sudo gem install crowd2
96
-
97
95
  == FILES:
98
96
 
99
97
  * <tt>README.rdoc</tt> - You're soaking in it
@@ -106,6 +104,16 @@ Ruby client for Atlassian Crowd 2.0.5
106
104
  * <tt>lib/crowd/soap/default.rb</tt> - Generated
107
105
  * <tt>lib/crowd/soap/SecurityServerClient.rb</tt> - Generated
108
106
 
107
+ == AUTHORS:
108
+
109
+ updated by Stefan Wille <post@stefanwille.com>
110
+
111
+ updated by Olli Helenius <liff@iki.fi>
112
+
113
+ updated by Evgeny Zislis (evgeny.zislis@gmail.com)
114
+
115
+ original by Jason Rimmer (jrimmer@irth.net) & gemified for rubyforge by Daniel Morrison (http://collectiveidea.com)
116
+
109
117
  == LICENSE:
110
118
 
111
119
  Public Domain
data/Rakefile CHANGED
@@ -28,13 +28,15 @@ begin
28
28
  Jeweler::Tasks.new do |gemspec|
29
29
  gemspec.name = "crowd-stefanwille"
30
30
  gemspec.version = Crowd::Version::STRING
31
- gemspec.summary = "Ruby client for Atlassian Crowd"
32
- gemspec.description = "A client for Atlassian[http://www.atlassian.com] Crowd[http://www.atlassian.com/crowd] v2.0.5"
31
+ gemspec.summary = "Ruby client for Atlassian Crowd 2.0"
32
+ gemspec.description = "A client for Atlassian[http://www.atlassian.com] Crowd[http://www.atlassian.com/crowd] v2.0. Tested with Crowd 2.0.2 and 2.0.5."
33
33
  gemspec.email = "post @nospam@ stefanwille.com"
34
34
  gemspec.homepage = "http://github.com/stefanwille/crowd"
35
35
  gemspec.authors = ["Stefan Wille", "Evgeny Zislis", "Jason Rimmer & Daniel Morrison"]
36
36
  gemspec.add_dependency('soap4r')
37
37
  gemspec.add_development_dependency('rspec')
38
+ # Silence a warning about missing rubyforge_project
39
+ gemspec.rubyforge_project = "nowarning"
38
40
  end
39
41
  rescue LoadError
40
42
  puts "Jeweler not available. Install it with: gem install jeweler"
@@ -4,13 +4,13 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{stefanwille-crowd}
8
- s.version = "0.5.8"
7
+ s.name = %q{crowd-stefanwille}
8
+ s.version = "0.5.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Stefan Wille", "Evgeny Zislis", "Jason Rimmer & Daniel Morrison"]
12
- s.date = %q{2010-07-14}
13
- s.description = %q{A client for Atlassian[http://www.atlassian.com] Crowd[http://www.atlassian.com/crowd] v2.0.5}
12
+ s.date = %q{2010-07-20}
13
+ s.description = %q{A client for Atlassian[http://www.atlassian.com] Crowd[http://www.atlassian.com/crowd] v2.0. Tested with Crowd 2.0.2 and 2.0.5.}
14
14
  s.email = %q{post @nospam@ stefanwille.com}
15
15
  s.extra_rdoc_files = [
16
16
  "README.rdoc"
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  "History.txt",
21
21
  "README.rdoc",
22
22
  "Rakefile",
23
+ "crowd-stefanwille.gemspec",
23
24
  "demo/crowd_demo.rb",
24
25
  "lib/crowd.rb",
25
26
  "lib/crowd/http/request.rb",
@@ -30,15 +31,16 @@ Gem::Specification.new do |s|
30
31
  "lib/crowd/soap/default.rb",
31
32
  "lib/crowd/soap/driver.rb",
32
33
  "lib/crowd/soap/mapping_registry.rb",
34
+ "lib/crowd/user_attribute_keys.rb",
33
35
  "lib/crowd/version.rb",
34
- "spec/crowd_spec.rb",
35
- "stefanwille-crowd.gemspec"
36
+ "spec/crowd_spec.rb"
36
37
  ]
37
38
  s.homepage = %q{http://github.com/stefanwille/crowd}
38
39
  s.rdoc_options = ["--charset=UTF-8"]
39
40
  s.require_paths = ["lib"]
41
+ s.rubyforge_project = %q{nowarning}
40
42
  s.rubygems_version = %q{1.3.7}
41
- s.summary = %q{Ruby client for Atlassian Crowd}
43
+ s.summary = %q{Ruby client for Atlassian Crowd 2.0}
42
44
  s.test_files = [
43
45
  "spec/crowd_spec.rb"
44
46
  ]
data/lib/crowd.rb CHANGED
@@ -10,26 +10,10 @@ require 'base64'
10
10
  require 'rubygems'
11
11
  gem 'soap4r'
12
12
 
13
+ require File.join(File.dirname(__FILE__), 'crowd', 'user_attribute_keys')
13
14
  require File.join(File.dirname(__FILE__), 'crowd', 'version')
14
15
  require File.join(File.dirname(__FILE__), 'crowd', 'soap', 'driver.rb')
15
16
 
16
- #
17
- # Place 'server.wiredump_dev = STDERR' after any to see
18
- # the raw SOAP calls and responses in a test console
19
- #
20
-
21
- # public static final String USERNAME = "username";
22
- # public static final String FIRSTNAME = "givenName";
23
- # public static final String LASTNAME = "sn";
24
- # public static final String DISPLAYNAME = "displayName";
25
- # public static final String EMAIL = "mail";
26
- # public static final String ICON_LOCATION = "iconLocation";
27
- # public static final String PASSWORD_LASTCHANGED = "passwordLastChanged";
28
- # public static final String LAST_AUTHENTICATED = "lastAuthenticated";
29
- # public static final String INVALID_PASSWORD_ATTEMPTS = "invalidPasswordAttempts";
30
- # public static final String REQUIRES_PASSWORD_CHANGE = "requiresPasswordChange";
31
- # public static final String ACTIVE = "active";
32
- #
33
17
 
34
18
  class Crowd
35
19
 
@@ -42,25 +26,71 @@ class Crowd
42
26
  # Class variables
43
27
  #
44
28
  private
45
-
29
+
46
30
  @@application_token = nil
47
31
  @@crowd_app_name = nil
48
32
  @@crowd_app_pword = nil
49
-
50
- public
51
-
52
33
  @@crowd_url = nil
34
+ @@crowd_session_tokenkey = 'crowd.token_key'
35
+ @@crowd_session_validationinterval = 0
36
+ @@crowd_session_lastvalidation = 'session.lastvalidation'
37
+
38
+ public
53
39
 
40
+ #
41
+ # Configuration
42
+ #
43
+
44
+ '''
45
+ The URL to use when connecting with the integration libraries to communicate with the Crowd server.
46
+ '''
54
47
  def self.crowd_url=(value); @@crowd_url = value; end
48
+
49
+ '''
50
+ The name that the application will use when authenticating with the Crowd server.
51
+ This needs to match the name you specified in Crowd server.
52
+ '''
55
53
  def self.crowd_app_name=(value); @@crowd_app_name = value; end
54
+
55
+ '''
56
+ The password that the application will use when authenticating with the Crowd server.
57
+ This needs to match the password you specified in Crowd server.
58
+ '''
56
59
  def self.crowd_app_pword=(value); @@crowd_app_pword = value; end
57
60
 
61
+ #
62
+ # Relevant for SSO:
63
+ #
64
+
65
+ '''
66
+ The number of minutes to cache authentication validation in the session.
67
+ If this value is set to 0, each HTTP request will be authenticated with the Crowd server.
68
+ '''
69
+ def self.crowd_session_validationinterval=(value); @@crowd_session_validationinterval = value; end
70
+
71
+ '''
72
+ The session key to use when storing a String value of the users authentication token.
73
+ Has a good default.
74
+ '''
75
+ def self.crowd_session_tokenkey=(value); @@crowd_session_tokenkey = value; end
76
+
77
+ '''
78
+ The session key to use when storing a timestamp of the users last authentication.
79
+ Has a good default.
80
+ '''
81
+ def self.crowd_session_lastvalidation=(value); @@crowd_session_lastvalidation = value; end
58
82
 
59
83
  # for testing
84
+ def self.application_token=(value); @@application_token = value; end
85
+ def self.application_token; @@application_token; end
60
86
  def self.crowd_url; @@crowd_url; end
61
87
  def self.crowd_app_name; @@crowd_app_name; end
62
88
  def self.crowd_app_pword; @@crowd_app_pword; end
63
- def self.application_token; @@application_token; end
89
+
90
+ def self.crowd_session_tokenkey; @@crowd_session_tokenkey; end
91
+ def self.crowd_session_validationinterval; @@crowd_session_validationinterval; end
92
+ def self.crowd_session_lastvalidation; @@crowd_session_lastvalidation; end
93
+
64
94
 
65
95
  public
66
96
 
@@ -0,0 +1,20 @@
1
+ class Crowd
2
+
3
+ #
4
+ # Keys for user attributes
5
+ #
6
+ module UserAttributeKeys
7
+ USERNAME = "username"
8
+ FIRSTNAME = "givenName"
9
+ LASTNAME = "sn"
10
+ DISPLAYNAME = "displayName"
11
+ EMAIL = "mail"
12
+ ICON_LOCATION = "iconLocation"
13
+ PASSWORD_LASTCHANGED = "passwordLastChanged"
14
+ LAST_AUTHENTICATED = "lastAuthenticated"
15
+ INVALID_PASSWORD_ATTEMPTS = "invalidPasswordAttempts"
16
+ REQUIRES_PASSWORD_CHANGE = "requiresPasswordChange"
17
+ ACTIVE = "active"
18
+ end
19
+
20
+ end
data/lib/crowd/version.rb CHANGED
@@ -2,7 +2,7 @@ class Crowd #:nodoc:
2
2
  module Version #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 5
5
- TINY = 8
5
+ TINY = 9
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/spec/crowd_spec.rb CHANGED
@@ -11,15 +11,7 @@ gem 'soap4r'
11
11
 
12
12
  require File.join(File.dirname(__FILE__), '..', 'lib', 'crowd')
13
13
 
14
- # need a special accessor for tests
15
- class Crowd
16
- def self.application_token
17
- @@application_token
18
- end
19
- def self.application_token=(value)
20
- @@application_token = value
21
- end
22
- end
14
+ include Crowd::UserAttributeKeys
23
15
 
24
16
  describe Crowd do
25
17
  before(:all) do
@@ -34,7 +26,7 @@ describe Crowd do
34
26
 
35
27
  it "should add a principal" do
36
28
  Crowd.add_principal('unittest','unittest','unit test user', true,
37
- { 'mail' => 'unittest@unittest.com', 'givenName' => 'Unit', 'sn' => 'Test' }).should_not be_nil
29
+ { 'mail' => 'unittest@unittest.com', FIRSTNAME => 'Unit', LASTNAME => 'Test' }).should_not be_nil
38
30
  end
39
31
 
40
32
  it "should find valid principal by name" do
@@ -89,14 +81,14 @@ describe Crowd do
89
81
  # Crowd.remove_role('test_role').should be_true
90
82
  # end
91
83
 
92
- it "should reset expired application token" do
84
+ it "should revalidate expired application token" do
93
85
  Crowd.application_token.token = 'fake'
94
86
  Crowd.application_token.token.should eql('fake')
95
87
  Crowd.find_principal_by_username('unittest')
96
88
  Crowd.application_token.token.should_not eql('fake')
97
89
  end
98
90
 
99
- it "should validate principal token with invalid token" do
91
+ it "should invalidate principal token with invalid token" do
100
92
  Crowd.is_valid_principal_token?('invalid').should be_false
101
93
  end
102
94
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crowd-stefanwille
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 8
10
- version: 0.5.8
9
+ - 9
10
+ version: 0.5.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Stefan Wille
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-07-14 00:00:00 +02:00
20
+ date: 2010-07-20 00:00:00 +02:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -48,7 +48,7 @@ dependencies:
48
48
  version: "0"
49
49
  type: :development
50
50
  version_requirements: *id002
51
- description: A client for Atlassian[http://www.atlassian.com] Crowd[http://www.atlassian.com/crowd] v2.0.5
51
+ description: A client for Atlassian[http://www.atlassian.com] Crowd[http://www.atlassian.com/crowd] v2.0. Tested with Crowd 2.0.2 and 2.0.5.
52
52
  email: post @nospam@ stefanwille.com
53
53
  executables: []
54
54
 
@@ -61,6 +61,7 @@ files:
61
61
  - History.txt
62
62
  - README.rdoc
63
63
  - Rakefile
64
+ - crowd-stefanwille.gemspec
64
65
  - demo/crowd_demo.rb
65
66
  - lib/crowd.rb
66
67
  - lib/crowd/http/request.rb
@@ -71,9 +72,9 @@ files:
71
72
  - lib/crowd/soap/default.rb
72
73
  - lib/crowd/soap/driver.rb
73
74
  - lib/crowd/soap/mapping_registry.rb
75
+ - lib/crowd/user_attribute_keys.rb
74
76
  - lib/crowd/version.rb
75
77
  - spec/crowd_spec.rb
76
- - stefanwille-crowd.gemspec
77
78
  has_rdoc: true
78
79
  homepage: http://github.com/stefanwille/crowd
79
80
  licenses: []
@@ -103,10 +104,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
104
  version: "0"
104
105
  requirements: []
105
106
 
106
- rubyforge_project:
107
+ rubyforge_project: nowarning
107
108
  rubygems_version: 1.3.7
108
109
  signing_key:
109
110
  specification_version: 3
110
- summary: Ruby client for Atlassian Crowd
111
+ summary: Ruby client for Atlassian Crowd 2.0
111
112
  test_files:
112
113
  - spec/crowd_spec.rb