proxy_auth 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/lib/proxy_auth/token.rb +1 -1
  3. data/lib/proxy_auth/version.rb +1 -1
  4. data/spec/controllers/proxy_auth/register_services_controller_spec.rb +10 -0
  5. data/spec/dummy/Rakefile +2 -0
  6. data/spec/dummy/app/assets/javascripts/application.js +1 -0
  7. data/spec/dummy/app/assets/stylesheets/application.css +4 -0
  8. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  9. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  10. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  11. data/spec/dummy/bin/bundle +3 -0
  12. data/spec/dummy/bin/rails +4 -0
  13. data/spec/dummy/bin/rake +4 -0
  14. data/spec/dummy/bin/setup +29 -0
  15. data/spec/dummy/config/application.rb +13 -0
  16. data/spec/dummy/config/boot.rb +5 -0
  17. data/spec/dummy/config/environment.rb +5 -0
  18. data/spec/dummy/config/environments/development.rb +11 -0
  19. data/spec/dummy/config/environments/production.rb +14 -0
  20. data/spec/dummy/config/environments/test.rb +13 -0
  21. data/spec/dummy/config/initializers/assets.rb +1 -0
  22. data/spec/dummy/config/initializers/cookies_serializer.rb +1 -0
  23. data/spec/dummy/config/initializers/filter_parameter_logging.rb +1 -0
  24. data/spec/dummy/config/initializers/proxy_auth.rb +1 -0
  25. data/spec/dummy/config/initializers/session_store.rb +1 -0
  26. data/spec/dummy/config/initializers/wrap_parameters.rb +3 -0
  27. data/spec/dummy/config/routes.rb +3 -0
  28. data/spec/dummy/config/secrets.yml +22 -0
  29. data/spec/dummy/config.ru +4 -0
  30. data/spec/dummy/public/404.html +1 -0
  31. data/spec/dummy/public/422.html +1 -0
  32. data/spec/dummy/public/500.html +1 -0
  33. data/spec/dummy/public/favicon.ico +0 -0
  34. data/spec/proxy_auth/connection_spec.rb +9 -0
  35. data/spec/proxy_auth/token_spec.rb +15 -0
  36. data/spec/rails_helper.rb +6 -0
  37. data/spec/routing/proxy_auth/register_services_routing_spec.rb +12 -0
  38. data/spec/spec_helper.rb +9 -0
  39. metadata +74 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0cc1120eab4d287eae62113299c2efb9dce9818b
4
- data.tar.gz: ba84cc9a4fbcfddd0ed992678c1a75e14720064e
3
+ metadata.gz: 3929c5728e347894105ea301987185d422ae98d9
4
+ data.tar.gz: 72cb4b31b49a1079c0ca59fc15989e02a95ab4e2
5
5
  SHA512:
6
- metadata.gz: 814fbda0aa08400bad068689088b6c2a6135b5463f69e25630d4f116c5bbc19b5c3271f1129dd7f73c4ee7f0d2ca2b50ff8ada106e5320a29c58abcbfc4d84e8
7
- data.tar.gz: 107438d0555ed84d38064b94af31b3be0a5ab88a0046b4720f31e42f73d2d4f4902631796f4e3ddf40075a76bb2db4e0dcc34cde8462a4815f741742307500d0
6
+ metadata.gz: db07ef8688195b9ba8a355533b93a9e2d43564fdbdb64fa18f47b77758de1bb0f7a18719ea3c34ba394f6f7b450ceb2d1a8a7596afaace49bed2401e745d4f94
7
+ data.tar.gz: 25b3e6f8fd4276612c4817dcd66d8968e028627751bf0655f6fad3f8f1911c86184b2a1aefc7cb9cdd166e3b28ed5dd03081fdd0371ab586c2571bddb0f06959
@@ -26,7 +26,7 @@ module ProxyAuth
26
26
  def set_token
27
27
  connection = Connection.new
28
28
  3.times do
29
- @token = connection.service_token
29
+ @token ||= connection.service_token
30
30
  @token && break || sleep(5)
31
31
  end
32
32
  end
@@ -1,4 +1,4 @@
1
1
  # Gem version
2
2
  module ProxyAuth
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.4'
4
4
  end
@@ -0,0 +1,10 @@
1
+ require 'rails_helper'
2
+
3
+ describe ProxyAuth::RegisterServicesController, type: :controller do
4
+ routes { ProxyAuth::Engine.routes }
5
+
6
+ it 'returns status 200' do
7
+ post :create
8
+ expect(response).to have_http_status(:ok)
9
+ end
10
+ end
@@ -0,0 +1,2 @@
1
+ require File.expand_path('../config/application', __FILE__)
2
+ Rails.application.load_tasks
@@ -0,0 +1 @@
1
+ //= require_tree .
@@ -0,0 +1,4 @@
1
+ /*
2
+ *= require_tree .
3
+ *= require_self
4
+ */
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery with: :exception
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts "== Installing dependencies =="
12
+ system "gem install bundler --conservative"
13
+ system "bundle check || bundle install"
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system "bin/rake db:setup"
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system "rm -f log/*"
25
+ system "rm -rf tmp/cache"
26
+
27
+ puts "\n== Restarting application server =="
28
+ system "touch tmp/restart.txt"
29
+ end
@@ -0,0 +1,13 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+ require 'action_controller/railtie'
3
+ require 'action_mailer/railtie'
4
+ require 'sprockets/railtie'
5
+ require 'rails/test_unit/railtie'
6
+
7
+ Bundler.require(*Rails.groups)
8
+ require 'proxy_auth'
9
+
10
+ module Dummy
11
+ class Application < Rails::Application
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,11 @@
1
+ Rails.application.configure do
2
+ config.cache_classes = false
3
+ config.eager_load = false
4
+ config.consider_all_requests_local = true
5
+ config.action_controller.perform_caching = false
6
+ config.action_mailer.raise_delivery_errors = false
7
+ config.active_support.deprecation = :log
8
+ config.assets.debug = true
9
+ config.assets.digest = true
10
+ config.assets.raise_runtime_errors = true
11
+ end
@@ -0,0 +1,14 @@
1
+ Rails.application.configure do
2
+ config.cache_classes = true
3
+ config.eager_load = true
4
+ config.consider_all_requests_local = false
5
+ config.action_controller.perform_caching = true
6
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
7
+ config.assets.js_compressor = :uglifier
8
+ config.assets.compile = false
9
+ config.assets.digest = true
10
+ config.log_level = :debug
11
+ config.i18n.fallbacks = true
12
+ config.active_support.deprecation = :notify
13
+ config.log_formatter = ::Logger::Formatter.new
14
+ end
@@ -0,0 +1,13 @@
1
+ Rails.application.configure do
2
+ config.cache_classes = true
3
+ config.eager_load = false
4
+ config.serve_static_files = true
5
+ config.static_cache_control = 'public, max-age=3600'
6
+ config.consider_all_requests_local = true
7
+ config.action_controller.perform_caching = false
8
+ config.action_dispatch.show_exceptions = false
9
+ config.action_controller.allow_forgery_protection = false
10
+ config.action_mailer.delivery_method = :test
11
+ config.active_support.test_order = :random
12
+ config.active_support.deprecation = :stderr
13
+ end
@@ -0,0 +1 @@
1
+ Rails.application.config.assets.version = '1.0'
@@ -0,0 +1 @@
1
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1 @@
1
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1 @@
1
+ ProxyAuth::Token.instance
@@ -0,0 +1 @@
1
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,3 @@
1
+ ActiveSupport.on_load(:action_controller) do
2
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
3
+ end
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ mount ProxyAuth::Engine => '/proxy'
3
+ end
@@ -0,0 +1,22 @@
1
+ default: &default
2
+ proxy:
3
+ token: 0987
4
+ url: http://localhost:5100
5
+ service:
6
+ name: dummy
7
+ url: http://localhost:5300
8
+ admin_login: 'admin'
9
+ admin_password: 'secret'
10
+
11
+ development:
12
+ <<: *default
13
+ secret_key_base: 1fe9a5e4b1aaa07ad8bc3137f1e92cd09a5522e059c73f522922344704da8d2c34663305b458865ad6e933021d8dfa971d1f26cff8c94c1df4cd0624e61299b5
14
+
15
+ test:
16
+ <<: *default
17
+ secret_key_base: 94039740e5438c8d20e397386eb484c20e2852b976fbd85b0d60f658e0ba80392479b7b93ce681e18e44e602d2c44c23337f523ca49e02d3c16d440fec0e7326
18
+
19
+ production:
20
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
21
+ admin_login: <%= ENV["ADMIN_LOGIN"] %>
22
+ admin_password: <%= ENV["ADMIN_PASSWORD"] %>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1 @@
1
+ 404 Not Found
@@ -0,0 +1 @@
1
+ 422 Unprocessable Entity
@@ -0,0 +1 @@
1
+ 500 Internal Server Error
File without changes
@@ -0,0 +1,9 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe ProxyAuth::Connection do
4
+ describe '#service_token' do
5
+ it 'gets the token' do
6
+ expect(subject.service_token).not_to be_nil
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe ProxyAuth::Token do
4
+ subject { described_class.instance }
5
+
6
+ context '#valid?' do
7
+ it 'returns true for valid token' do
8
+ expect(subject.valid? subject.token).to be_truthy
9
+ end
10
+
11
+ it 'returns false for invalid token' do
12
+ expect(subject.valid? "#{subject.token}1").to be_falsey
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,6 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+ require 'spec_helper'
3
+ require File.expand_path('../dummy/config/environment', __FILE__)
4
+ require 'rspec/rails'
5
+
6
+ RSpec.configure(&:infer_spec_type_from_file_location!)
@@ -0,0 +1,12 @@
1
+ require 'rails_helper'
2
+
3
+ describe ProxyAuth::RegisterServicesController, type: :routing do
4
+ routes { ProxyAuth::Engine.routes }
5
+
6
+ it 'POST #show' do
7
+ expect(post 'register_service').to route_to(
8
+ controller: 'proxy_auth/register_services',
9
+ action: 'create'
10
+ )
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ RSpec.configure do |config|
2
+ config.expect_with :rspec do |expectations|
3
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
4
+ end
5
+
6
+ config.mock_with :rspec do |mocks|
7
+ mocks.verify_partial_doubles = true
8
+ end
9
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proxy_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grzegorz Lisowski
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-25 00:00:00.000000000 Z
12
+ date: 2015-06-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -60,6 +60,41 @@ files:
60
60
  - lib/proxy_auth/token.rb
61
61
  - lib/proxy_auth/version.rb
62
62
  - lib/tasks/proxy_auth.rake
63
+ - spec/controllers/proxy_auth/register_services_controller_spec.rb
64
+ - spec/dummy/Rakefile
65
+ - spec/dummy/app/assets/javascripts/application.js
66
+ - spec/dummy/app/assets/stylesheets/application.css
67
+ - spec/dummy/app/controllers/application_controller.rb
68
+ - spec/dummy/app/helpers/application_helper.rb
69
+ - spec/dummy/app/views/layouts/application.html.erb
70
+ - spec/dummy/bin/bundle
71
+ - spec/dummy/bin/rails
72
+ - spec/dummy/bin/rake
73
+ - spec/dummy/bin/setup
74
+ - spec/dummy/config.ru
75
+ - spec/dummy/config/application.rb
76
+ - spec/dummy/config/boot.rb
77
+ - spec/dummy/config/environment.rb
78
+ - spec/dummy/config/environments/development.rb
79
+ - spec/dummy/config/environments/production.rb
80
+ - spec/dummy/config/environments/test.rb
81
+ - spec/dummy/config/initializers/assets.rb
82
+ - spec/dummy/config/initializers/cookies_serializer.rb
83
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
84
+ - spec/dummy/config/initializers/proxy_auth.rb
85
+ - spec/dummy/config/initializers/session_store.rb
86
+ - spec/dummy/config/initializers/wrap_parameters.rb
87
+ - spec/dummy/config/routes.rb
88
+ - spec/dummy/config/secrets.yml
89
+ - spec/dummy/public/404.html
90
+ - spec/dummy/public/422.html
91
+ - spec/dummy/public/500.html
92
+ - spec/dummy/public/favicon.ico
93
+ - spec/proxy_auth/connection_spec.rb
94
+ - spec/proxy_auth/token_spec.rb
95
+ - spec/rails_helper.rb
96
+ - spec/routing/proxy_auth/register_services_routing_spec.rb
97
+ - spec/spec_helper.rb
63
98
  homepage:
64
99
  licenses:
65
100
  - MIT
@@ -80,8 +115,43 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
115
  version: '0'
81
116
  requirements: []
82
117
  rubyforge_project:
83
- rubygems_version: 2.4.5
118
+ rubygems_version: 2.4.6
84
119
  signing_key:
85
120
  specification_version: 4
86
121
  summary: Proxy authentication client
87
- test_files: []
122
+ test_files:
123
+ - spec/controllers/proxy_auth/register_services_controller_spec.rb
124
+ - spec/spec_helper.rb
125
+ - spec/routing/proxy_auth/register_services_routing_spec.rb
126
+ - spec/proxy_auth/token_spec.rb
127
+ - spec/proxy_auth/connection_spec.rb
128
+ - spec/rails_helper.rb
129
+ - spec/dummy/config.ru
130
+ - spec/dummy/config/secrets.yml
131
+ - spec/dummy/config/routes.rb
132
+ - spec/dummy/config/application.rb
133
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
134
+ - spec/dummy/config/initializers/cookies_serializer.rb
135
+ - spec/dummy/config/initializers/proxy_auth.rb
136
+ - spec/dummy/config/initializers/assets.rb
137
+ - spec/dummy/config/initializers/wrap_parameters.rb
138
+ - spec/dummy/config/initializers/session_store.rb
139
+ - spec/dummy/config/environment.rb
140
+ - spec/dummy/config/boot.rb
141
+ - spec/dummy/config/environments/production.rb
142
+ - spec/dummy/config/environments/development.rb
143
+ - spec/dummy/config/environments/test.rb
144
+ - spec/dummy/app/controllers/application_controller.rb
145
+ - spec/dummy/app/helpers/application_helper.rb
146
+ - spec/dummy/app/views/layouts/application.html.erb
147
+ - spec/dummy/app/assets/javascripts/application.js
148
+ - spec/dummy/app/assets/stylesheets/application.css
149
+ - spec/dummy/bin/setup
150
+ - spec/dummy/bin/rails
151
+ - spec/dummy/bin/bundle
152
+ - spec/dummy/bin/rake
153
+ - spec/dummy/Rakefile
154
+ - spec/dummy/public/422.html
155
+ - spec/dummy/public/500.html
156
+ - spec/dummy/public/favicon.ico
157
+ - spec/dummy/public/404.html