danski-ooh-auth 0.1.3 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -16,8 +16,8 @@ GEM_NAME = "ooh-auth"
16
16
  AUTHOR = "Dan Glegg"
17
17
  EMAIL = "dan@angryamoeba.co.uk"
18
18
  HOMEPAGE = "http://github.com/danski/ooh-auth"
19
- SUMMARY = "Merb Slice that adds a full OAuth provider strategy to your application."
20
- GEM_VERSION = "0.1.3"
19
+ SUMMARY = "Merb Slice that provides RESTful authentication functionality for your application."
20
+ GEM_VERSION = "0.9.10"
21
21
 
22
22
  spec = Gem::Specification.new do |s|
23
23
  s.rubyforge_project = 'merb'
@@ -34,7 +34,7 @@ class OohAuth::Tokens < OohAuth::Application
34
34
  @token = OohAuth::Token.create_request_key(@authenticating_client)
35
35
  end
36
36
  # # Okay, no error raised. Gogo render.
37
- display @token, :show, :layout=>false
37
+ display @token, :show, :layout=>nil
38
38
  end
39
39
 
40
40
  def new
@@ -2,12 +2,12 @@
2
2
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
3
3
  <head>
4
4
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5
- <title>OohAuth Slice</title>
5
+ <title>Full-fat Auth Slice</title>
6
6
  </head>
7
7
  <!-- you can override this layout at slices/ooh-auth/app/views/layout/ooh-auth.html.erb -->
8
8
  <body class="ooh-auth">
9
9
  <div id="root">
10
- <h1>OohAuth Slice</h1>
10
+ <h1>Full-fat Auth Slice</h1>
11
11
 
12
12
  <% unless message.blank? %>
13
13
  <div id="_message">
data/lib/ooh-auth.rb CHANGED
@@ -2,12 +2,12 @@ if defined?(Merb::Plugins)
2
2
 
3
3
  $:.unshift File.dirname(__FILE__)
4
4
 
5
- dependency "merb-action-args"
6
- dependency 'merb-auth-core'
7
- dependency 'merb-auth-more'
8
- dependency 'merb-slices'
9
- dependency "merb-helpers"
10
- dependency "merb-assets"
5
+ load_dependency "merb-action-args"
6
+ load_dependency 'merb-auth-core'
7
+ load_dependency 'merb-auth-more'
8
+ load_dependency 'merb-slices'
9
+ load_dependency "merb-helpers"
10
+ load_dependency "merb-assets"
11
11
 
12
12
  Merb::Plugins.add_rakefiles "ooh-auth/merbtasks", "ooh-auth/slicetasks", "ooh-auth/spectasks"
13
13
 
@@ -46,8 +46,8 @@ if defined?(Merb::Plugins)
46
46
  module OohAuth
47
47
 
48
48
  # Slice metadata
49
- self.description = "OohAuth is Merb slice that extends merb-auth-more with a full OAuth provider"
50
- self.version = "0.1.3"
49
+ self.description = "OohAuth is Merb slice that extends merb-auth-more with RESTful authentication"
50
+ self.version = "0.0.1"
51
51
  self.author = "Dan Glegg"
52
52
  self.identifier = "ooh-auth"
53
53
 
data/readme.markdown CHANGED
@@ -29,7 +29,7 @@ It depends on:
29
29
  * merb-auth-more
30
30
  * nokogiri (tests only)
31
31
  * ruby-hmac
32
- * Erb OR Haml (Haml support thanks to [http://github.com/pius](Pius))
32
+ * Erb **(we need your help to get started on HAML support)**
33
33
  * datamapper **(we need your help to become ORM-agnostic)**
34
34
 
35
35
  You should read:
@@ -27,10 +27,10 @@ describe OohAuth::AuthenticatingClients do
27
27
  @user = user_class.gen
28
28
 
29
29
  @bad_authenticating_client_attrs = OohAuth::AuthenticatingClient.gen.attributes
30
- [:name, :user_id].each {|a| @bad_authenticating_client_attrs.delete(a) }
30
+ [:name].each {|a| @bad_authenticating_client_attrs.delete(a) }
31
31
 
32
32
  @good_authenticating_client_attrs = OohAuth::AuthenticatingClient.gen(:kind=>"desktop").attributes
33
- [:id, :secret, :api_key, :user_id].each {|a| @good_authenticating_client_attrs.delete(a) }
33
+ [:id, :secret, :api_key].each {|a| @good_authenticating_client_attrs.delete(a) }
34
34
  @good_authenticating_client_attrs[:name] = "unique fo realz"
35
35
 
36
36
  @controller = OohAuth::AuthenticatingClients.new(Merb::Test::RequestHelper::FakeRequest.new)
@@ -53,13 +53,17 @@ describe OohAuth::AuthenticatingClients do
53
53
  @controller.headers['Location'].should == @controller.slice_url(:authenticating_client, @controller.assigns(:authenticating_client))
54
54
  (ac_count + 1).should == OohAuth::AuthenticatingClient.count
55
55
  end
56
+ it "should assign the authenticated user's ID regardless of user_id in the form data" do
57
+ @controller.create(@good_authenticating_client_attrs.merge(:user_id=>@user.id+1000))
58
+ @controller.assigns(:authenticating_client).user_id.should == @user.id
59
+ end
56
60
  end
57
61
 
58
62
  describe "show action" do
59
63
  before :each do
60
64
  @user = user_class.gen
61
- @authenticating_client = OohAuth::AuthenticatingClient.gen(:user=>@user)
62
- @other_authenticating_client = OohAuth::AuthenticatingClient.gen
65
+ @authenticating_client = OohAuth::AuthenticatingClient.gen(:user_id=>@user.id)
66
+ @other_authenticating_client = OohAuth::AuthenticatingClient.gen(:user_id=>@user.id+1000)
63
67
  @controller = OohAuth::AuthenticatingClients.new(Merb::Test::RequestHelper::FakeRequest.new)
64
68
  @controller.request.session.user = @user
65
69
  end
@@ -76,8 +80,8 @@ describe OohAuth::AuthenticatingClients do
76
80
  describe "edit/update action" do
77
81
  before :each do
78
82
  @user = user_class.gen
79
- @authenticating_client = OohAuth::AuthenticatingClient.gen(:user=>@user)
80
- @other_authenticating_client = OohAuth::AuthenticatingClient.gen
83
+ @authenticating_client = OohAuth::AuthenticatingClient.gen(:user_id=>@user.id)
84
+ @other_authenticating_client = OohAuth::AuthenticatingClient.gen(:user_id=>@user.id+1000)
81
85
  @controller = OohAuth::AuthenticatingClients.new(Merb::Test::RequestHelper::FakeRequest.new)
82
86
  @controller.request.session.user = @user
83
87
  end
@@ -26,7 +26,7 @@ describe OohAuth::Tokens do
26
26
  describe "index action" do
27
27
  %w(js yaml xml html).each do |format|
28
28
  it "#{format} requests should generate an anonymous receipt when sent GET with a consumer and no other information." do
29
- @controller = get(sign_url_with(@authenticating_client, @controller.slice_url(:tokens, :format=>format)))
29
+ @controller = get(sign_url_with(@authenticating_client, @controller.slice_url(:tokens), :format=>format))
30
30
  @controller.should be_successful
31
31
  request_token = @controller.assigns(:token)
32
32
  request_token.should be_kind_of(OohAuth::Token)
@@ -36,11 +36,10 @@ describe OohAuth::Tokens do
36
36
  end
37
37
 
38
38
  it "should return OAuth-format key responses if no format is specified" do
39
- @controller = get(sign_url_with(@authenticating_client, @controller.slice_url(:tokens, :format=>"html")))
39
+ @controller = get(sign_url_with(@authenticating_client, @controller.slice_url(:tokens)))
40
40
  request_token = @controller.assigns(:token)
41
41
  @controller.body.should == "oauth_token=#{request_token.token_key}&oauth_token_secret=#{request_token.secret}"
42
42
  end
43
-
44
43
 
45
44
  it "should generate nothing and return a 406 not acceptable when the request is not signed or contains an incorrect API key" do
46
45
  lambda {get(@controller.slice_url(:tokens, :oauth_consumer_key=>@authenticating_client.api_key))}.should raise_error(Merb::Controller::NotAcceptable)
@@ -40,5 +40,11 @@ describe OohAuth::AuthenticatingClient do
40
40
  arr = OohAuth::AuthenticatingClient.find_for_user(nil)
41
41
  arr.length.should == 0
42
42
  end
43
+
44
+ it "should return a list of authenticating clients when find_for_user is called with a valid user" do
45
+ @authenticating_clients = 10.of {OohAuth::AuthenticatingClient.gen(:user_id=>@user.id)}
46
+ arr = OohAuth::AuthenticatingClient.find_for_user(@user)
47
+ arr.length.should == 10
48
+ end
43
49
 
44
50
  end
@@ -7,6 +7,7 @@ OohAuth::Mocks::User.fixture{{
7
7
  }}
8
8
 
9
9
  OohAuth::AuthenticatingClient.fixture{{
10
+ :user_id => /\d{1,3}/.gen,
10
11
  :name => /\w+/.gen,
11
12
  :web_url => "http://www.#{ /\w+/.gen }.com/client/",
12
13
  :api_key => /\w+/.gen,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danski-ooh-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Glegg