Revision 24b3b9d6 src/authm_mad/one_auth_mad.rb
src/authm_mad/one_auth_mad.rb | ||
---|---|---|
52 | 52 |
# built-in ACL engine |
53 | 53 |
# @param [Array] authentication modules enabled, nil will use any |
54 | 54 |
# any method existing in remotes directory |
55 |
def initialize(authZ, authN, nthreads) |
|
55 |
# @param [Numeric] number of threads |
|
56 |
# @param [Hash] extra options |
|
57 |
def initialize(authZ, authN, nthreads, options = {}) |
|
56 | 58 |
super( |
57 | 59 |
"auth", |
58 |
:concurrency => nthreads, |
|
59 |
:threaded => nthreads > 0, |
|
60 |
:local_actions => {ACTION[:authN] => nil, ACTION[:authZ] => nil} |
|
60 |
options.merge({ |
|
61 |
:concurrency => nthreads, |
|
62 |
:threaded => nthreads > 0, |
|
63 |
:local_actions => { |
|
64 |
ACTION[:authN] => nil, |
|
65 |
ACTION[:authZ] => nil |
|
66 |
} |
|
67 |
}) |
|
61 | 68 |
) |
62 | 69 |
|
63 | 70 |
register_action(ACTION[:authN].to_sym, method("authN")) |
... | ... | |
173 | 180 |
opts = GetoptLong.new( |
174 | 181 |
[ '--threads', '-t', GetoptLong::REQUIRED_ARGUMENT ], |
175 | 182 |
[ '--authz', '-z', GetoptLong::REQUIRED_ARGUMENT ], |
176 |
[ '--authn', '-n', GetoptLong::REQUIRED_ARGUMENT ] |
|
183 |
[ '--authn', '-n', GetoptLong::REQUIRED_ARGUMENT ], |
|
184 |
[ '--timeout', '-w', GetoptLong::OPTIONAL_ARGUMENT ] |
|
177 | 185 |
) |
178 | 186 |
|
179 | 187 |
threads = 15 |
180 | 188 |
authz = nil |
181 | 189 |
authn = nil |
190 |
timeout = nil |
|
182 | 191 |
|
183 | 192 |
begin |
184 | 193 |
opts.each do |opt, arg| |
... | ... | |
189 | 198 |
authz = arg |
190 | 199 |
when '--authn' |
191 | 200 |
authn = arg.split(',').map {|a| a.strip } |
201 |
when '--timeout' |
|
202 |
timeout = arg |
|
192 | 203 |
end |
193 | 204 |
end |
194 | 205 |
rescue Exception => e |
195 | 206 |
exit(-1) |
196 | 207 |
end |
197 | 208 |
|
198 |
auth_driver = AuthDriver.new(authz, authn, threads) |
|
209 |
auth_driver = AuthDriver.new(authz, authn, threads, |
|
210 |
:timeout => timeout) |
|
199 | 211 |
|
200 | 212 |
auth_driver.start_driver |
Also available in: Unified diff