vidibus-user 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -42,14 +42,14 @@ GEM
42
42
  rack (>= 1.0.1)
43
43
  gemcutter (0.6.1)
44
44
  git (1.2.5)
45
- httparty (0.6.1)
46
- crack (= 0.1.8)
47
45
  i18n (0.4.1)
48
46
  jeweler (1.4.0)
49
47
  gemcutter (>= 0.1.0)
50
48
  git (>= 1.2.5)
51
49
  rubyforge (>= 2.0.0)
50
+ json (1.5.1)
52
51
  json_pure (1.4.6)
52
+ macaddr (1.0.0)
53
53
  mail (2.2.6.1)
54
54
  activesupport (>= 2.3.6)
55
55
  mime-types
@@ -104,6 +104,22 @@ GEM
104
104
  treetop (1.4.8)
105
105
  polyglot (>= 0.3.1)
106
106
  tzinfo (0.3.23)
107
+ uuid (2.3.1)
108
+ macaddr (~> 1.0)
109
+ vidibus-core_extensions (0.3.16)
110
+ vidibus-secure (0.0.4)
111
+ activesupport (~> 3.0.0)
112
+ activesupport (~> 3.0.0)
113
+ mongoid (~> 2.0.0.beta.20)
114
+ mongoid (~> 2.0.0.beta.20)
115
+ rack
116
+ vidibus-core_extensions
117
+ vidibus-core_extensions
118
+ vidibus-uuid (0.3.10)
119
+ mongoid (~> 2.0.0.beta.17)
120
+ mongoid (~> 2.0.0.beta.20)
121
+ uuid (~> 2.3.1)
122
+ uuid (~> 2.3.1)
107
123
  warden (0.10.7)
108
124
  rack (>= 1.0.0)
109
125
  webmock (1.3.5)
@@ -115,8 +131,8 @@ PLATFORMS
115
131
  ruby
116
132
 
117
133
  DEPENDENCIES
118
- httparty
119
134
  jeweler
135
+ json
120
136
  mongoid (~> 2.0.0.beta.20)
121
137
  oauth2
122
138
  rails (~> 3.0.0)
@@ -124,5 +140,7 @@ DEPENDENCIES
124
140
  relevance-rcov
125
141
  rr
126
142
  rspec (~> 2.0.0.beta.20)
143
+ vidibus-secure
144
+ vidibus-uuid
127
145
  warden
128
146
  webmock
data/README.rdoc CHANGED
@@ -1,8 +1,8 @@
1
- = vidibus-user
1
+ = Vidibus::User
2
2
 
3
3
  Provides single sign-on through OAuth2 authentication. It adds a simple user model to your application which can be extended easily.
4
4
 
5
- This gem is part of the open source SOA framework Vidibus: vidibus.org.
5
+ This gem is part of the open source SOA framework {Vidibus}[http://vidibus.org].
6
6
 
7
7
  It is far from being complete, but this will change soon.
8
8
 
@@ -18,18 +18,18 @@ Then call bundle install on your console.
18
18
 
19
19
  == Obtaining user data
20
20
 
21
- After authorization via OAuth this gem requests user data from providing service. It will call the following route:
21
+ After authorization via OAuth2 this gem requests user data from the providing service. It will call the following route:
22
22
 
23
23
  /oauth/user
24
24
 
25
- It expects JSON data to be returned. The dataset must at least include the user's uuid.
25
+ It expects JSON data to be returned. The dataset must at least include the user's UUID.
26
26
 
27
- The vidibus-oauth2_server gem will provide a controller for this task.
27
+ The {Vidibus::Oauth2Server}[https://github.com/vidibus/vidibus-oauth2_server] gem will provide a controller for this task.
28
28
 
29
29
 
30
30
  == Dependencies
31
31
 
32
- In order to perform authentication, this gem depends on services provided by the vidibus-service gem.
32
+ In order to perform authentication, this gem depends on services provided by the {Vidibus::Service}[https://github.com/vidibus/vidibus-service] gem.
33
33
 
34
34
 
35
35
  == TODO
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -4,9 +4,6 @@ module Vidibus
4
4
  extend ActiveSupport::Concern
5
5
  included do
6
6
  field :uuid
7
- field :email
8
- field :name
9
- validates :email, :name, :presence => true
10
7
  validates :uuid, :uuid => true
11
8
  end
12
9
  end
@@ -53,14 +53,14 @@ Warden::Strategies.add(:connector) do
53
53
  begin
54
54
  response = access_token.get("/oauth/user")
55
55
  user_data = JSON.parse(response)
56
- unless user = User.where(:uuid => user_data["uuid"]).first
57
- unless user = User.create(user_data)
58
- raise "user.errors = #{user.errors.inspect}"
59
- end
60
- end
56
+ selector = {:uuid => user_data["uuid"]}
57
+ user = User.where(selector).first || User.new(selector)
58
+ user.save!
61
59
  rescue OAuth2::HTTPError
62
60
  Rails.logger.error "Failed to fetch user data from #{credentials[:service_url]}/oauth/user"
63
61
  user = true
62
+ rescue => e
63
+ Rails.logger.error "Error: #{e.message}"
64
64
  end
65
65
 
66
66
  success!(user)
data/vidibus-user.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{vidibus-user}
8
- s.version = "0.0.3"
8
+ s.version = "0.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andre Pankratz"]
12
- s.date = %q{2011-01-14}
12
+ s.date = %q{2011-02-04}
13
13
  s.description = %q{Provides single sign-on and a local user model.}
14
14
  s.email = %q{andre@vidibus.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vidibus-user
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andre Pankratz
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-14 00:00:00 +01:00
18
+ date: 2011-02-04 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency