cadenero 0.0.2.a1 → 0.0.2.a2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -18,14 +18,14 @@ Authentication Engine for Rails.API multitenant RESTful APIs based on Warden. It
18
18
  ### Why Cadenero?
19
19
  **"Cadenero"** is the spanish word for ["Bouncer (doorman)"](http://en.wikipedia.org/wiki/Bouncer_(doorman\)). The main function of **Cadenero** is to be a resource for authenticating consumers of the services that the API provides. As the real bouncers, **Cadenero** aims to provide security, check authorized access, to refuse entry for intoxication, aggressive behavior or non-compliance with statutory or establishment rules.
20
20
 
21
- ### Inatalling **Cadenero**
21
+ ### Installing **Cadenero**
22
22
  Generate first your Rails.API app as usual using:
23
23
  ```
24
24
  > rails-api new your_app --skip-test-unit
25
25
  ```
26
26
  In the `Gemfile` add the following lines:
27
27
  ```ruby
28
- gem 'cadenero', '~> 0.0.2.a1'
28
+ gem 'cadenero', '~> 0.0.2.a2'
29
29
  gem 'pg'
30
30
  ```
31
31
  In the `config/database.yml` replace the `sqlite3` adapter for `postgresql` as follow:
@@ -41,7 +41,7 @@ test:
41
41
  min_messages: warning
42
42
  ```
43
43
 
44
- Then run bundle, create the databases and the generator:
44
+ Then run bundle, create the databases and run the generator:
45
45
  ```
46
46
  > bundle install; rake db:create; rails-api g cadenero:install
47
47
  ```
@@ -49,10 +49,19 @@ Finally run the server:
49
49
  ```
50
50
  rails-api s
51
51
  ```
52
+ Or much better for checking the multitenancy you can use [Pow](http://pow.cx/). To install or upgrade Pow, open a terminal and run this command:
53
+ ```
54
+ $ curl get.pow.cx | sh (View Source)
55
+ ```
56
+ To set up a Rack app, just symlink it into ~/.pow:
57
+ ```
58
+ $ cd ~/.pow
59
+ $ ln -s /path/to/myapp
60
+ ```
52
61
 
53
- Check that you can access the API using the default account `www` and user `testy@example.com` with password `changeme˜ for that you can use [cURL](http://curl.haxx.se/) or [RESTClient](http://restclient.net/)
62
+ Check that you can access the API using the default account `www` and user `testy@example.com` with password `changeme˜ or those defined for you when the generator was run. Ror the client you can use [cURL](http://curl.haxx.se/) or [RESTClient](http://restclient.net/)
54
63
 
55
- Then have fun!
64
+ Have fun!
56
65
 
57
66
  ### Access Points
58
67
  **Cadenero** creates the following versioned routes for exposing the authentication RESTful API
@@ -82,7 +91,7 @@ rake routes
82
91
 
83
92
  If you discover a problem with **Cadenero**, we would like to know about it. However, we ask that you please review these guidelines before submitting a bug report:
84
93
 
85
- https://github.com/agiltec/cadenero/wiki/Bug-reports
94
+ https://github.com/AgilTec/cadenero/wiki/Bug-reports
86
95
 
87
96
  If you found a security bug, do *NOT* use the GitHub issue tracker. Send an email to the maintainers listed at the bottom of the README please.
88
97
 
@@ -90,7 +99,7 @@ If you found a security bug, do *NOT* use the GitHub issue tracker. Send an emai
90
99
 
91
100
  We hope that you will consider contributing to **Cadenero**. Please read this short overview for some information about how to get started:
92
101
 
93
- https://github.com/agiltec/devise/cadenero/Contributing
102
+ https://github.com/AgilTec/cadenero/Contributing
94
103
 
95
104
  You will usually want to write tests for your changes using BDD tools as RSpec, Rack::Test and Capybara. To run the test suite, go into **Cadenero**'s top-level directory and run "bundle install" and "rspec". For the tests to pass, you will need to have a Postgresql server running on your system.
96
105
 
@@ -1,3 +1,3 @@
1
1
  module Cadenero
2
- VERSION = "0.0.2.a1"
2
+ VERSION = "0.0.2.a2"
3
3
  end
@@ -66,7 +66,7 @@ module Cadenero
66
66
  end
67
67
 
68
68
  def determine_default_user_password
69
- Cadenero.default_user_password = options["default-user-password "].presence ||
69
+ Cadenero.default_user_password = options["default-user-password"].presence ||
70
70
  ask("What will be the password for the default user owner of the default account? [change-me]").presence ||
71
71
  'change-me'
72
72
  end
@@ -532,3 +532,84 @@ env['warden'].authenticated?(:user): false
532
532
  Filter chain halted as :authenticate_user! rendered or redirected
533
533
  Completed 422 Unprocessable Entity in 1ms (Views: 0.2ms | ActiveRecord: 0.0ms)
534
534
  Connecting to database specified by database.yml
535
+
536
+
537
+ Started POST "/v1/sessions" for 127.0.0.1 at 2013-06-27 23:43:41 -0500
538
+
539
+ Apartment::SchemaNotFound (One of the following schema(s) is invalid: test3):
540
+ apartment (0.21.1) lib/apartment/adapters/postgresql_adapter.rb:82:in `rescue in connect_to_new'
541
+ apartment (0.21.1) lib/apartment/adapters/postgresql_adapter.rb:75:in `connect_to_new'
542
+ apartment (0.21.1) lib/apartment/adapters/abstract_adapter.rb:93:in `switch'
543
+ apartment (0.21.1) lib/apartment/elevators/generic.rb:17:in `call'
544
+ apartment (0.21.1) lib/apartment/reloader.rb:19:in `call'
545
+ rack (1.4.5) lib/rack/etag.rb:23:in `call'
546
+ rack (1.4.5) lib/rack/conditionalget.rb:35:in `call'
547
+ actionpack (3.2.13) lib/action_dispatch/middleware/head.rb:14:in `call'
548
+ actionpack (3.2.13) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
549
+ activerecord (3.2.13) lib/active_record/query_cache.rb:64:in `call'
550
+ activerecord (3.2.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
551
+ actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
552
+ activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `_run__756117718638477808__call__3994278690128380133__callbacks'
553
+ activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `__run_callback'
554
+ activesupport (3.2.13) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
555
+ activesupport (3.2.13) lib/active_support/callbacks.rb:81:in `run_callbacks'
556
+ actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
557
+ actionpack (3.2.13) lib/action_dispatch/middleware/reloader.rb:65:in `call'
558
+ actionpack (3.2.13) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
559
+ actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
560
+ actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
561
+ railties (3.2.13) lib/rails/rack/logger.rb:32:in `call_app'
562
+ railties (3.2.13) lib/rails/rack/logger.rb:16:in `block in call'
563
+ activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in `tagged'
564
+ railties (3.2.13) lib/rails/rack/logger.rb:16:in `call'
565
+ actionpack (3.2.13) lib/action_dispatch/middleware/request_id.rb:22:in `call'
566
+ rack (1.4.5) lib/rack/runtime.rb:17:in `call'
567
+ activesupport (3.2.13) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
568
+ rack (1.4.5) lib/rack/lock.rb:15:in `call'
569
+ actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:in `call'
570
+ railties (3.2.13) lib/rails/engine.rb:479:in `call'
571
+ railties (3.2.13) lib/rails/application.rb:223:in `call'
572
+ railties (3.2.13) lib/rails/railtie/configurable.rb:30:in `method_missing'
573
+ /Users/manuelevidaurrea/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/lib/nack/server.rb:147:in `handle'
574
+ /Users/manuelevidaurrea/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/lib/nack/server.rb:99:in `rescue in block (2 levels) in start'
575
+ /Users/manuelevidaurrea/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/lib/nack/server.rb:96:in `block (2 levels) in start'
576
+ /Users/manuelevidaurrea/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/lib/nack/server.rb:86:in `each'
577
+ /Users/manuelevidaurrea/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/lib/nack/server.rb:86:in `block in start'
578
+ /Users/manuelevidaurrea/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/lib/nack/server.rb:66:in `loop'
579
+ /Users/manuelevidaurrea/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/lib/nack/server.rb:66:in `start'
580
+ /Users/manuelevidaurrea/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/lib/nack/server.rb:13:in `run'
581
+ /Users/manuelevidaurrea/Library/Application Support/Pow/Versions/0.4.0/node_modules/nack/bin/nack_worker:4:in `<main>'
582
+
583
+
584
+ Rendered /Users/manuelevidaurrea/Documents/work/agiltec/workspace/ruby/rails/cadenero/vendor/bundle/gems/actionpack-3.2.13/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.8ms)
585
+ Rendered /Users/manuelevidaurrea/Documents/work/agiltec/workspace/ruby/rails/cadenero/vendor/bundle/gems/actionpack-3.2.13/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.2ms)
586
+ Rendered /Users/manuelevidaurrea/Documents/work/agiltec/workspace/ruby/rails/cadenero/vendor/bundle/gems/actionpack-3.2.13/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (20.2ms)
587
+
588
+
589
+ Started POST "/v1/accounts" for 127.0.0.1 at 2013-06-27 23:45:05 -0500
590
+ Processing by Cadenero::V1::AccountsController#create as HTML
591
+ Parameters: {"account"=>{"name"=>"Testy", "subdomain"=>"test", "owner_attributes"=>{"email"=>"testy@example.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}}, "default"=>:json}
592
+  (0.2ms) BEGIN
593
+ Cadenero::V1::Account Exists (0.5ms) SELECT 1 AS one FROM "public"."cadenero_accounts" WHERE "public"."cadenero_accounts"."subdomain" = 'test' LIMIT 1
594
+ SQL (2.3ms) INSERT INTO "public"."cadenero_users" ("created_at", "email", "password_digest", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["created_at", Fri, 28 Jun 2013 04:45:05 UTC +00:00], ["email", "testy@example.com"], ["password_digest", "$2a$10$ItllcpD13XNrNciXgTwWc.tyyvFtfjaTd6xNuM0Rq5b6cMKdm3DWa"], ["updated_at", Fri, 28 Jun 2013 04:45:05 UTC +00:00]]
595
+ SQL (0.8ms) INSERT INTO "public"."cadenero_accounts" ("authentication_token", "created_at", "name", "owner_id", "subdomain", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["authentication_token", nil], ["created_at", Fri, 28 Jun 2013 04:45:06 UTC +00:00], ["name", "Testy"], ["owner_id", 3], ["subdomain", "test"], ["updated_at", Fri, 28 Jun 2013 04:45:06 UTC +00:00]]
596
+  (0.7ms) COMMIT
597
+  (0.2ms) BEGIN
598
+ SQL (1.0ms) INSERT INTO "public"."cadenero_members" ("account_id", "created_at", "updated_at", "user_id") VALUES ($1, $2, $3, $4) RETURNING "id" [["account_id", 3], ["created_at", Fri, 28 Jun 2013 04:45:06 UTC +00:00], ["updated_at", Fri, 28 Jun 2013 04:45:06 UTC +00:00], ["user_id", 3]]
599
+  (0.9ms) COMMIT
600
+ Cadenero::V1::Account Exists (0.5ms) SELECT 1 AS one FROM "public"."cadenero_accounts" WHERE ("public"."cadenero_accounts"."subdomain" = 'test' AND "public"."cadenero_accounts"."id" != 3) LIMIT 1
601
+  (1.3ms) CREATE SCHEMA "test"
602
+  (13.7ms) CREATE TABLE "cadenero_accounts" ("id" serial primary key, "name" character varying(255), "subdomain" character varying(255), "authentication_token" character varying(255), "owner_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
603
+  (1.5ms) CREATE INDEX "index_cadenero_accounts_on_authentication_token" ON "cadenero_accounts" ("authentication_token")
604
+  (2.3ms) CREATE INDEX "index_cadenero_accounts_on_owner_id" ON "cadenero_accounts" ("owner_id")
605
+  (4.6ms) CREATE TABLE "cadenero_members" ("id" serial primary key, "account_id" integer, "user_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
606
+  (1.5ms) CREATE INDEX "index_cadenero_members_on_account_id" ON "cadenero_members" ("account_id")
607
+  (8.9ms) CREATE INDEX "index_cadenero_members_on_user_id" ON "cadenero_members" ("user_id")
608
+  (5.8ms) CREATE TABLE "cadenero_users" ("id" serial primary key, "email" character varying(255), "password_digest" character varying(255), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
609
+  (4.5ms) CREATE TABLE "schema_migrations" ("version" character varying(255) NOT NULL)
610
+  (5.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
611
+  (0.3ms) SELECT version FROM "schema_migrations"
612
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20130612073709')
613
+ Cadenero::V1::Account Load (0.5ms) SELECT "public"."cadenero_accounts".* FROM "public"."cadenero_accounts" WHERE "public"."cadenero_accounts"."authentication_token" = 'uugLhBDmxWtCPAbbqUps' LIMIT 1
614
+ Cadenero::V1::Account Load (0.2ms) SELECT "public"."cadenero_accounts".* FROM "public"."cadenero_accounts" WHERE "public"."cadenero_accounts"."authentication_token" = 'i4tz4J5zEFMc21WfrLPs' LIMIT 1
615
+ Completed 201 Created in 423ms (Views: 0.2ms | ActiveRecord: 78.7ms)