openshift-origin-auth-mongo 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYRIGHT +1 -0
- data/Gemfile +3 -0
- data/LICENSE +11 -0
- data/README.md +3 -0
- data/Rakefile +11 -0
- data/bin/oo-register-user +92 -0
- data/lib/openshift-origin-auth-mongo/app/controllers/account_controller.rb +34 -0
- data/lib/openshift-origin-auth-mongo/app/models/rest_account.rb +12 -0
- data/lib/openshift-origin-auth-mongo/config/initializers/openshift-origin-auth-mongo-defaults.conf +12 -0
- data/lib/openshift-origin-auth-mongo/config/initializers/openshift-origin-auth-mongo.rb +62 -0
- data/lib/openshift-origin-auth-mongo/config/routes.rb +7 -0
- data/lib/openshift-origin-auth-mongo/engine/engine.rb +12 -0
- data/lib/openshift-origin-auth-mongo/lib/openshift/mongo_auth_service.rb +73 -0
- data/lib/openshift-origin-auth-mongo.rb +8 -0
- data/openshift-origin-auth-mongo.gemspec +31 -0
- data/rubygem-openshift-origin-auth-mongo.spec +146 -0
- data/test/dummy/Gemfile +32 -0
- data/test/dummy/README +256 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +42 -0
- data/test/dummy/config/boot.rb +6 -0
- data/test/dummy/config/database.yml +5 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/test.rb +58 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/seeds.rb +7 -0
- data/test/dummy/doc/README_FOR_APP +2 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/images/rails.png +0 -0
- data/test/dummy/public/index.html +239 -0
- data/test/dummy/public/javascripts/application.js +2 -0
- data/test/dummy/public/javascripts/controls.js +965 -0
- data/test/dummy/public/javascripts/dragdrop.js +974 -0
- data/test/dummy/public/javascripts/effects.js +1123 -0
- data/test/dummy/public/javascripts/prototype.js +6001 -0
- data/test/dummy/public/javascripts/rails.js +191 -0
- data/test/dummy/public/robots.txt +5 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/performance/browsing_test.rb +9 -0
- data/test/dummy/test/test_helper.rb +13 -0
- data/test/functional/account_controller_test.rb +32 -0
- data/test/test_helper.rb +5 -0
- metadata +229 -0
data/COPYRIGHT
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Copyright 2012 Red Hat, Inc. and/or its affiliates.
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
2
|
+
you may not use this file except in compliance with the License.
|
3
|
+
You may obtain a copy of the License at
|
4
|
+
|
5
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
|
7
|
+
Unless required by applicable law or agreed to in writing, software
|
8
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
See the License for the specific language governing permissions and
|
11
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,3 @@
|
|
1
|
+
Notice of Export Control Law
|
2
|
+
|
3
|
+
This software distribution includes cryptographic software that is subject to the U.S. Export Administration Regulations (the "*EAR*") and other U.S. and foreign laws and may not be exported, re-exported or transferred (a) to any country listed in Country Group E:1 in Supplement No. 1 to part 740 of the EAR (currently, Cuba, Iran, North Korea, Sudan & Syria); (b) to any prohibited destination or to any end user who has been prohibited from participating in U.S. export transactions by any federal agency of the U.S. government; or (c) for use in connection with the design, development or production of nuclear, chemical or biological weapons, or rocket systems, space launch vehicles, or sounding rockets, or unmanned air vehicle systems.You may not download this software or technical information if you are located in one of these countries or otherwise subject to these restrictions. You may not provide this software or technical information to individuals or entities located in one of these countries or otherwise subject to these restrictions. You are also responsible for compliance with foreign law requirements applicable to the import, export and use of this software and technical information.
|
data/Rakefile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#require "bundler/gem_tasks"
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
5
|
+
Rake::TestTask.new(:test) do |t|
|
6
|
+
sh "/usr/bin/mongo localhost/openshift_origin_broker_test --eval 'db.addUser(\"openshift\", \"mooo\")'"
|
7
|
+
t.libs << 'test'
|
8
|
+
t.warning = false
|
9
|
+
t.verbose = true
|
10
|
+
t.test_files = FileList['test/**/*_test.rb']
|
11
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'getoptlong'
|
4
|
+
require 'active_resource'
|
5
|
+
|
6
|
+
def p_usage
|
7
|
+
puts <<USAGE
|
8
|
+
Usage: #{$0}
|
9
|
+
Register a new user.
|
10
|
+
|
11
|
+
-l|--login Login for admin user
|
12
|
+
-p|--password Password for admin user
|
13
|
+
--username User name for the new user
|
14
|
+
--userpass User password for the new user
|
15
|
+
-h|--help Show usage info
|
16
|
+
|
17
|
+
USAGE
|
18
|
+
exit 1
|
19
|
+
end
|
20
|
+
|
21
|
+
begin
|
22
|
+
opts = GetoptLong.new(
|
23
|
+
["--login", "-l", GetoptLong::REQUIRED_ARGUMENT],
|
24
|
+
["--password", "-p", GetoptLong::REQUIRED_ARGUMENT],
|
25
|
+
["--username", GetoptLong::REQUIRED_ARGUMENT],
|
26
|
+
["--userpass", GetoptLong::REQUIRED_ARGUMENT],
|
27
|
+
["--help", "-h", GetoptLong::NO_ARGUMENT]
|
28
|
+
)
|
29
|
+
opt = {}
|
30
|
+
opts.each do |o, a|
|
31
|
+
opt[o[2..-1]] = a.to_s
|
32
|
+
end
|
33
|
+
rescue Exception => e
|
34
|
+
#puts e.message
|
35
|
+
p_usage
|
36
|
+
end
|
37
|
+
|
38
|
+
if opt['help'] || !opt['login'] || !opt['password'] || !opt['username'] || !opt['userpass']
|
39
|
+
p_usage
|
40
|
+
end
|
41
|
+
|
42
|
+
ActiveResource::Base.include_root_in_json = false
|
43
|
+
module ActiveResource
|
44
|
+
module Formats
|
45
|
+
#
|
46
|
+
# The OpenShift REST API wraps the root resource element whi
|
47
|
+
# to be unwrapped.
|
48
|
+
#
|
49
|
+
module OpenshiftJsonFormat
|
50
|
+
extend ActiveResource::Formats::JsonFormat
|
51
|
+
extend self
|
52
|
+
|
53
|
+
def decode(json)
|
54
|
+
decoded = super
|
55
|
+
if decoded.is_a?(Hash) and decoded.has_key?('data')
|
56
|
+
decoded = decoded['data']
|
57
|
+
end
|
58
|
+
if decoded.is_a?(Array)
|
59
|
+
decoded.each { |i| i.delete 'links' }
|
60
|
+
else
|
61
|
+
decoded.delete 'links'
|
62
|
+
end
|
63
|
+
decoded
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
$options = opt
|
70
|
+
class Account < ActiveResource::Base
|
71
|
+
self.site="https://localhost/broker/rest"
|
72
|
+
self.user = $options['login']
|
73
|
+
self.password = $options['password']
|
74
|
+
self.format = :OpenshiftJson
|
75
|
+
|
76
|
+
def read_errors
|
77
|
+
error_data = JSON.parse(@remote_errors.response.body)
|
78
|
+
error_data["messages"]
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
acc = Account.new(:username => opt['username'], :password => opt['userpass'])
|
83
|
+
if acc.save
|
84
|
+
print "User created succesfully\n"
|
85
|
+
else
|
86
|
+
errors = acc.read_errors
|
87
|
+
if errors.nil? || errors.empty?
|
88
|
+
print "An unknown error has occured"
|
89
|
+
else
|
90
|
+
print "#{errors[0]["text"]}\n"
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class AccountController < BaseController
|
2
|
+
respond_to :xml, :json
|
3
|
+
before_filter :authenticate, :check_version
|
4
|
+
|
5
|
+
def create
|
6
|
+
username = params[:username]
|
7
|
+
password = params[:password]
|
8
|
+
|
9
|
+
auth_config = Rails.application.config.auth
|
10
|
+
auth_service = OpenShift::MongoAuthService.new(auth_config)
|
11
|
+
|
12
|
+
Rails.logger.debug "username = #{username}, password = #{password}"
|
13
|
+
|
14
|
+
if(username.nil? || password.nil? || username.strip.empty? || password.strip.empty?)
|
15
|
+
log_action('nil', 'nil', username, "ADD_USER", false, "Username or password not specified or empty")
|
16
|
+
@reply = RestReply.new(:unprocessable_entity)
|
17
|
+
@reply.messages.push(Message.new(:error, "Invalid username or password", 1001, "username"))
|
18
|
+
respond_with @reply, :status => @reply.status
|
19
|
+
return
|
20
|
+
end
|
21
|
+
|
22
|
+
if auth_service.user_exists?(username)
|
23
|
+
log_action('nil', 'nil', username, "ADD_USER", false, "User '#{username}' already registered")
|
24
|
+
@reply = RestReply.new(:unprocessable_entity)
|
25
|
+
@reply.messages.push(Message.new(:error, "Error: User '#{username}' already registered.", 1002, "id"))
|
26
|
+
respond_with @reply, :status => @reply.status
|
27
|
+
else
|
28
|
+
log_action('nil', 'nil', username, "ADD_USER", true, "User '#{username}' successfully registered")
|
29
|
+
auth_service.register_user(username,password)
|
30
|
+
@reply = RestReply.new(:created, "domain", RestAccount.new(username, Time.new))
|
31
|
+
respond_with @reply, :status => @reply.status
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class RestAccount < OpenShift::Model
|
2
|
+
attr_accessor :username, :created_on
|
3
|
+
|
4
|
+
def initialize(username, created_on)
|
5
|
+
self.username, self.created_on = username, created_on
|
6
|
+
end
|
7
|
+
|
8
|
+
def to_xml(options={})
|
9
|
+
options[:tag_name] = "account"
|
10
|
+
super(options)
|
11
|
+
end
|
12
|
+
end
|
data/lib/openshift-origin-auth-mongo/config/initializers/openshift-origin-auth-mongo-defaults.conf
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
AUTH_SALT="ClWqe5zKtEW4CJEMyjzQ"
|
2
|
+
AUTH_PRIVKEYFILE="/var/www/openshift/broker/config/server_priv.pem"
|
3
|
+
AUTH_PRIVKEYPASS=""
|
4
|
+
AUTH_PUBKEYFILE="/var/www/openshift/broker/config/server_pub.pem"
|
5
|
+
|
6
|
+
MONGO_REPLICA_SETS=false
|
7
|
+
# Replica set example: "<host-1>:<port-1> <host-2>:<port-2> ..."
|
8
|
+
MONGO_HOST_PORT="localhost:27017"
|
9
|
+
MONGO_USER="openshift"
|
10
|
+
MONGO_PASSWORD="mooo"
|
11
|
+
MONGO_DB="openshift_broker_dev"
|
12
|
+
MONGO_COLLECTION="auth_user"
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'openshift-origin-common/config'
|
2
|
+
|
3
|
+
Broker::Application.configure do
|
4
|
+
conf = OpenShift::Config.new(File.join(OpenShift::Config::PLUGINS_DIR, File.basename(__FILE__, '.rb') + '.conf'))
|
5
|
+
defaults = OpenShift::Config.new(File.join(File.dirname(__FILE__), File.basename(__FILE__, '.rb') + '-defaults.conf'))
|
6
|
+
|
7
|
+
# Grab this now because we need it for the MONGO_HOST_PORT parsing.
|
8
|
+
replica_sets = conf.get_bool("MONGO_REPLICA_SETS") || defaults.get_bool("MONGO_REPLICA_SETS")
|
9
|
+
|
10
|
+
hp = conf.get("MONGO_HOST_PORT") || defaults.get("MONGO_HOST_PORT")
|
11
|
+
|
12
|
+
# Depending on the value of the MONGO_REPLICA_SETS setting, MONGO_HOST_PORT
|
13
|
+
# must follow one of two formats, as described below.
|
14
|
+
|
15
|
+
if !hp
|
16
|
+
raise "Broker is missing Mongo configuration."
|
17
|
+
elif replica_sets
|
18
|
+
# The string should be of the following form:
|
19
|
+
#
|
20
|
+
# host-1:port-1 host-2:port-2 ...
|
21
|
+
#
|
22
|
+
# We need to parse into an array of arrays:
|
23
|
+
#
|
24
|
+
# [[<host-1>, <port-1>], [<host-2>, <port-2>], ...]
|
25
|
+
#
|
26
|
+
# where each host is a string and each port is an integer.
|
27
|
+
|
28
|
+
host_port = hp.split.map do |x|
|
29
|
+
(h,p) = x.split(":")
|
30
|
+
[h, p.to_i]
|
31
|
+
end
|
32
|
+
else
|
33
|
+
|
34
|
+
# The string should be of the following form:
|
35
|
+
#
|
36
|
+
# host:port
|
37
|
+
#
|
38
|
+
# We need to parse into an array:
|
39
|
+
#
|
40
|
+
# [host,port]
|
41
|
+
#
|
42
|
+
# where host is a string and port is an integer.
|
43
|
+
|
44
|
+
(h,p) = hp.split(":")
|
45
|
+
host_port = [h, p.to_i]
|
46
|
+
end
|
47
|
+
|
48
|
+
config.auth = {
|
49
|
+
:salt => conf.get("AUTH_SALT") || defaults.get("AUTH_SALT"),
|
50
|
+
:privkeyfile => conf.get("AUTH_PRIVKEYFILE") || defaults.get("AUTH_PRIVKEYFILE"),
|
51
|
+
:privkeypass => conf.get("AUTH_PRIVKEYPASS") || defaults.get("AUTH_PRIVKEYPASS"),
|
52
|
+
:pubkeyfile => conf.get("AUTH_PUBKEYFILE") || defaults.get("AUTH_PUBKEYFILE"),
|
53
|
+
|
54
|
+
:mongo_replica_sets => replica_sets,
|
55
|
+
:mongo_host_port => host_port,
|
56
|
+
|
57
|
+
:mongo_user => conf.get("MONGO_USER") || defaults.get("MONGO_USER"),
|
58
|
+
:mongo_password => conf.get("MONGO_PASSWORD") || defaults.get("MONGO_PASSWORD"),
|
59
|
+
:mongo_db => conf.get("MONGO_DB") || defaults.get("MONGO_DB"),
|
60
|
+
:mongo_collection => conf.get("MONGO_COLLECTION") || defaults.get("MONGO_COLLECTION")
|
61
|
+
}
|
62
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'openshift-origin-controller'
|
2
|
+
require 'rails'
|
3
|
+
|
4
|
+
module OpenShift
|
5
|
+
class MongoAuthServiceEngine < Rails::Engine
|
6
|
+
paths.app.controllers << "lib/openshift-origin-auth-mongo/app/controllers"
|
7
|
+
paths.lib << "lib/openshift-origin-auth-mongo/lib"
|
8
|
+
paths.config << "lib/openshift-origin-auth-mongo/config"
|
9
|
+
paths.app.models << "lib/openshift-origin-auth-mongo/app/models"
|
10
|
+
config.autoload_paths += %W(#{config.root}/lib)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'openshift-origin-controller'
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
module OpenShift
|
6
|
+
class MongoAuthService < OpenShift::AuthService
|
7
|
+
|
8
|
+
def initialize(auth_info = nil)
|
9
|
+
super
|
10
|
+
|
11
|
+
if @auth_info != nil
|
12
|
+
# no-op
|
13
|
+
elsif defined? Rails
|
14
|
+
@auth_info = Rails.application.config.auth
|
15
|
+
else
|
16
|
+
raise Exception.new("Mongo DataStore service is not initialized")
|
17
|
+
end
|
18
|
+
|
19
|
+
@replica_set = @auth_info[:mongo_replica_sets]
|
20
|
+
@host_port = @auth_info[:mongo_host_port]
|
21
|
+
@user = @auth_info[:mongo_user]
|
22
|
+
@password = @auth_info[:mongo_password]
|
23
|
+
@db = @auth_info[:mongo_db]
|
24
|
+
@collection = @auth_info[:mongo_collection]
|
25
|
+
end
|
26
|
+
|
27
|
+
def db
|
28
|
+
if @replica_set
|
29
|
+
con = Mongo::ReplSetConnection.new(*@host_port << {:read => :secondary})
|
30
|
+
else
|
31
|
+
con = Mongo::Connection.new(@host_port[0], @host_port[1])
|
32
|
+
end
|
33
|
+
user_db = con.db(@db)
|
34
|
+
user_db.authenticate(@user, @password) unless @user.nil?
|
35
|
+
user_db
|
36
|
+
end
|
37
|
+
|
38
|
+
def register_user(login,password)
|
39
|
+
encoded_password = Digest::MD5.hexdigest(Digest::MD5.hexdigest(password) + @salt)
|
40
|
+
db.collection(@collection).insert({"_id" => login, "user" => login, "password" => encoded_password})
|
41
|
+
end
|
42
|
+
|
43
|
+
def user_exists?(login)
|
44
|
+
hash = db.collection(@collection).find_one({"_id" => login})
|
45
|
+
!hash.nil?
|
46
|
+
end
|
47
|
+
|
48
|
+
def authenticate(request, login, password)
|
49
|
+
params = request.request_parameters()
|
50
|
+
if params['broker_auth_key'] && params['broker_auth_iv']
|
51
|
+
validate_broker_key(params['broker_auth_iv'], params['broker_auth_key'])
|
52
|
+
else
|
53
|
+
raise OpenShift::AccessDeniedException if login.nil? || login.empty? || password.nil? || password.empty?
|
54
|
+
encoded_password = Digest::MD5.hexdigest(Digest::MD5.hexdigest(password) + @salt)
|
55
|
+
hash = db.collection(@collection).find_one({"_id" => login})
|
56
|
+
if hash && !hash.empty? && (hash["password"] == encoded_password)
|
57
|
+
return {:username => login, :auth_method => :login}
|
58
|
+
else
|
59
|
+
raise OpenShift::AccessDeniedException
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def login(request, params, cookies)
|
65
|
+
if params['broker_auth_key'] && params['broker_auth_iv']
|
66
|
+
validate_broker_key(params['broker_auth_iv'], params['broker_auth_key'])
|
67
|
+
else
|
68
|
+
data = JSON.parse(params['json_data'])
|
69
|
+
return authenticate(request, data['rhlogin'], params['password'])
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
module OpenShift
|
2
|
+
module MongoAuthServiceModule
|
3
|
+
require 'openshift-origin-auth-mongo/engine/engine' if defined?(Rails) && Rails::VERSION::MAJOR == 3
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
require "openshift-origin-auth-mongo/lib/openshift/mongo_auth_service.rb"
|
8
|
+
OpenShift::AuthService.provider=OpenShift::MongoAuthService
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
lib_dir = File.join(File.join("lib", "**"), "*")
|
4
|
+
test_dir = File.join(File.join("test", "**"), "*")
|
5
|
+
bin_dir = File.join("bin","*")
|
6
|
+
spec_file = "rubygem-openshift-origin-auth-mongo.spec"
|
7
|
+
|
8
|
+
Gem::Specification.new do |s|
|
9
|
+
s.name = "openshift-origin-auth-mongo"
|
10
|
+
s.version = `rpm -q --qf "%{version}\n" --specfile #{spec_file}`.split[0]
|
11
|
+
s.license = `rpm -q --qf "%{license}\n" --specfile #{spec_file}`.split[0]
|
12
|
+
s.authors = ["Krishna Raman"]
|
13
|
+
s.email = ["kraman@gmail.com"]
|
14
|
+
s.homepage = `rpm -q --qf "%{url}\n" --specfile #{spec_file}`.split[0]
|
15
|
+
s.summary = `rpm -q --qf "%{description}\n" --specfile #{spec_file}`.split[0]
|
16
|
+
s.description = `rpm -q --qf "%{description}\n" --specfile #{spec_file}`.split[0]
|
17
|
+
|
18
|
+
s.rubyforge_project = "openshift-origin-auth-mongo"
|
19
|
+
|
20
|
+
s.files = Dir[lib_dir] + Dir[bin_dir]
|
21
|
+
s.test_files = Dir[test_dir]
|
22
|
+
s.executables = Dir[bin_dir].map {|binary| File.basename(binary)}
|
23
|
+
s.files += %w(README.md Rakefile Gemfile rubygem-openshift-origin-auth-mongo.spec openshift-origin-auth-mongo.gemspec LICENSE COPYRIGHT)
|
24
|
+
s.require_paths = ["lib"]
|
25
|
+
|
26
|
+
s.add_dependency('openshift-origin-controller')
|
27
|
+
s.add_dependency('json')
|
28
|
+
s.add_development_dependency('rake')
|
29
|
+
s.add_development_dependency('bundler')
|
30
|
+
s.add_development_dependency('mocha')
|
31
|
+
end
|
@@ -0,0 +1,146 @@
|
|
1
|
+
%global ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")
|
2
|
+
%global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
|
3
|
+
%global gemname openshift-origin-auth-mongo
|
4
|
+
%global geminstdir %{gemdir}/gems/%{gemname}-%{version}
|
5
|
+
|
6
|
+
Summary: OpenShift Origin plugin for mongo auth service
|
7
|
+
Name: rubygem-%{gemname}
|
8
|
+
Version: 0.8.9
|
9
|
+
Release: 1%{?dist}
|
10
|
+
Group: Development/Languages
|
11
|
+
License: ASL 2.0
|
12
|
+
URL: http://openshift.redhat.com
|
13
|
+
Source0: rubygem-%{gemname}-%{version}.tar.gz
|
14
|
+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
15
|
+
Requires: ruby(abi) = 1.8
|
16
|
+
Requires: rubygems
|
17
|
+
Requires: rubygem(openshift-origin-common)
|
18
|
+
Requires: rubygem(json)
|
19
|
+
Requires: rubygem(mocha)
|
20
|
+
Requires: openshift-origin-broker
|
21
|
+
Requires: selinux-policy-targeted
|
22
|
+
Requires: policycoreutils-python
|
23
|
+
Obsoletes: rubygem-swingshift-mongo-plugin
|
24
|
+
|
25
|
+
BuildRequires: ruby
|
26
|
+
BuildRequires: rubygems
|
27
|
+
BuildArch: noarch
|
28
|
+
Provides: rubygem(%{gemname}) = %version
|
29
|
+
|
30
|
+
%package -n ruby-%{gemname}
|
31
|
+
Summary: OpenShift Origin plugin for mongo auth service
|
32
|
+
Requires: rubygem(%{gemname}) = %version
|
33
|
+
Provides: ruby(%{gemname}) = %version
|
34
|
+
|
35
|
+
%description
|
36
|
+
Provides a mongo auth service based plugin
|
37
|
+
|
38
|
+
%description -n ruby-%{gemname}
|
39
|
+
Provides a mongo auth service based plugin
|
40
|
+
|
41
|
+
%prep
|
42
|
+
%setup -q
|
43
|
+
|
44
|
+
%build
|
45
|
+
|
46
|
+
%install
|
47
|
+
rm -rf %{buildroot}
|
48
|
+
mkdir -p %{buildroot}%{gemdir}
|
49
|
+
mkdir -p %{buildroot}%{ruby_sitelib}
|
50
|
+
mkdir -p %{buildroot}%{_bindir}
|
51
|
+
|
52
|
+
# Build and install into the rubygem structure
|
53
|
+
gem build %{gemname}.gemspec
|
54
|
+
gem install --local --install-dir %{buildroot}%{gemdir} --force %{gemname}-%{version}.gem
|
55
|
+
|
56
|
+
# Move the gem binaries to the standard filesystem location
|
57
|
+
mv %{buildroot}%{gemdir}/bin/* %{buildroot}%{_bindir}
|
58
|
+
rm -rf %{buildroot}%{gemdir}/bin
|
59
|
+
|
60
|
+
# Symlink into the ruby site library directories
|
61
|
+
ln -s %{geminstdir}/lib/%{gemname} %{buildroot}%{ruby_sitelib}
|
62
|
+
ln -s %{geminstdir}/lib/%{gemname}.rb %{buildroot}%{ruby_sitelib}
|
63
|
+
|
64
|
+
mkdir -p %{buildroot}/etc/openshift/plugins.d
|
65
|
+
cp lib/openshift-origin-auth-mongo/config/initializers/openshift-origin-auth-mongo-defaults.conf %{buildroot}/etc/openshift/plugins.d/openshift-origin-auth-mongo.conf
|
66
|
+
|
67
|
+
%clean
|
68
|
+
rm -rf %{buildroot}
|
69
|
+
|
70
|
+
%post
|
71
|
+
/usr/bin/openssl genrsa -out /var/www/openshift/broker/config/server_priv.pem 2048
|
72
|
+
/usr/bin/openssl rsa -in /var/www/openshift/broker/config/server_priv.pem -pubout > /var/www/openshift/broker/config/server_pub.pem
|
73
|
+
|
74
|
+
%files
|
75
|
+
%defattr(-,root,root,-)
|
76
|
+
%dir %{geminstdir}
|
77
|
+
%doc %{geminstdir}/Gemfile
|
78
|
+
%{gemdir}/doc/%{gemname}-%{version}
|
79
|
+
%{gemdir}/gems/%{gemname}-%{version}
|
80
|
+
%{gemdir}/cache/%{gemname}-%{version}.gem
|
81
|
+
%{gemdir}/specifications/%{gemname}-%{version}.gemspec
|
82
|
+
%{_bindir}/*
|
83
|
+
%config(noreplace) %{_sysconfdir}/openshift/plugins.d/openshift-origin-auth-mongo.conf
|
84
|
+
|
85
|
+
%files -n ruby-%{gemname}
|
86
|
+
%{ruby_sitelib}/%{gemname}
|
87
|
+
%{ruby_sitelib}/%{gemname}.rb
|
88
|
+
|
89
|
+
%changelog
|
90
|
+
* Thu Oct 11 2012 Brenton Leanhardt <bleanhar@redhat.com> 0.8.9-1
|
91
|
+
- fix for mongo auth plugin spec file (abhgupta@redhat.com)
|
92
|
+
- Centralize plug-in configuration (miciah.masters@gmail.com)
|
93
|
+
- Removing old build scripts Moving broker/node setup utilities into util
|
94
|
+
packages Fix Auth service module name conflicts (kraman@gmail.com)
|
95
|
+
- Merge pull request #613 from kraman/master (openshift+bot@redhat.com)
|
96
|
+
- Module name and gem path fixes for auth plugins (kraman@gmail.com)
|
97
|
+
|
98
|
+
* Mon Oct 08 2012 Dan McPherson <dmcphers@redhat.com> 0.8.8-1
|
99
|
+
-
|
100
|
+
|
101
|
+
* Fri Oct 05 2012 Krishna Raman <kraman@gmail.com> 0.8.7-1
|
102
|
+
- new package built with tito
|
103
|
+
|
104
|
+
* Mon Aug 20 2012 Brenton Leanhardt <bleanhar@redhat.com> 0.8.6-1
|
105
|
+
- gemspec refactorings based on Fedora packaging feedback (bleanhar@redhat.com)
|
106
|
+
- Providing a better error message for invalid broker iv/token
|
107
|
+
(kraman@gmail.com)
|
108
|
+
- fix for cartridge-jenkins_build.feature cucumber test (abhgupta@redhat.com)
|
109
|
+
- Bug 836055 - Bypass authentication by making a direct request to broker with
|
110
|
+
broker_auth_key (kraman@gmail.com)
|
111
|
+
- MCollective updates - Added mcollective-qpid plugin - Added mcollective-
|
112
|
+
msg-broker plugin - Added mcollective agent and facter plugins - Added
|
113
|
+
option to support ignoring node profile - Added systemu dependency for
|
114
|
+
mcollective-client (kraman@gmail.com)
|
115
|
+
- Updated gem info for rails 3.0.13 (admiller@redhat.com)
|
116
|
+
|
117
|
+
* Wed May 30 2012 Krishna Raman <kraman@gmail.com> 0.8.5-1
|
118
|
+
- Fix for Bugz 825366, 825340. SELinux changes to allow access to
|
119
|
+
user_action.log file. Logging authentication failures and user creation for
|
120
|
+
OpenShift Origin (abhgupta@redhat.com)
|
121
|
+
- Raise auth exception when no user/password is provided by web browser. Bug
|
122
|
+
815971 (kraman@gmail.com)
|
123
|
+
- Adding livecd build scripts Adding a text only minimal version of livecd
|
124
|
+
Added ability to access livecd dns from outside VM (kraman@gmail.com)
|
125
|
+
- Merge pull request #19 from kraman/dev/kraman/bug/815971
|
126
|
+
(dmcphers@redhat.com)
|
127
|
+
- Fix bug in mongo auth service where auth failure is returning nil instead of
|
128
|
+
Exception (kraman@gmail.com)
|
129
|
+
- Adding a seperate message for errors returned by cartridge when trying to add
|
130
|
+
them. Fixing CLIENT_RESULT error in node Removing tmp editor file
|
131
|
+
(kraman@gmail.com)
|
132
|
+
- Added tests (kraman@gmail.com)
|
133
|
+
- BugZ# 817957. Adding rest api for creating a user in the mongo auth service.
|
134
|
+
Rest API will be accessabel only from local host and will require login/pass
|
135
|
+
of an existing user. (kraman@gmail.com)
|
136
|
+
- moving broker auth key and iv encoding/decoding both into the plugin
|
137
|
+
(abhgupta@redhat.com)
|
138
|
+
|
139
|
+
* Thu Apr 26 2012 Krishna Raman <kraman@gmail.com> 0.8.4-1
|
140
|
+
- Added README for OpenShift Origin-mongo plugin (rpenta@redhat.com)
|
141
|
+
- cleaning up spec files (dmcphers@redhat.com)
|
142
|
+
- decoding the broker auth key before returning from login in the auth plugin
|
143
|
+
(abhgupta@redhat.com)
|
144
|
+
|
145
|
+
* Sat Apr 21 2012 Krishna Raman <kraman@gmail.com> 0.8.3-1
|
146
|
+
- new package built with tito
|
data/test/dummy/Gemfile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
gem 'rails', '3.0.13'
|
4
|
+
gem 'openshift-origin-auth-mongo'
|
5
|
+
gem 'mocha'
|
6
|
+
# Bundle edge Rails instead:
|
7
|
+
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
8
|
+
|
9
|
+
gem 'sqlite3'
|
10
|
+
|
11
|
+
# Use unicorn as the web server
|
12
|
+
# gem 'unicorn'
|
13
|
+
|
14
|
+
# Deploy with Capistrano
|
15
|
+
# gem 'capistrano'
|
16
|
+
|
17
|
+
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
|
18
|
+
# gem 'ruby-debug'
|
19
|
+
# gem 'ruby-debug19', :require => 'ruby-debug'
|
20
|
+
|
21
|
+
# Bundle the extra gems:
|
22
|
+
# gem 'bj'
|
23
|
+
# gem 'nokogiri'
|
24
|
+
# gem 'sqlite3-ruby', :require => 'sqlite3'
|
25
|
+
# gem 'aws-s3', :require => 'aws/s3'
|
26
|
+
|
27
|
+
# Bundle gems for the local environment. Make sure to
|
28
|
+
# put test-only gems in this group so their generators
|
29
|
+
# and rake tasks are available in development mode:
|
30
|
+
# group :development, :test do
|
31
|
+
# gem 'webrat'
|
32
|
+
# end
|