-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtaccess.rb
More file actions
49 lines (40 loc) · 874 Bytes
/
htaccess.rb
File metadata and controls
49 lines (40 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require_relative 'config_file'
#Child class of ConfigFile to parse and store data from Htaccess
class Htaccess < ConfigFile
attr_reader :config
def load
super
process_lines
end
def process_lines
@config = {}
#Rework this line so that if it sees Require, it will check to see if
#Require is for valid-users, users, or groups and then
#parse accordingly
lines.each do |line|
if line.length > 2
config[line[0]] = line[1..-1]
else
config[line[0]] = line[1].gsub(/"/, "")
end
end
end
def auth_user_file
@config["AuthUserFile"]
end
def auth_type
@config["AuthType"]
end
def auth_name
@config["AuthName"]
end
def require
@config["Require"]
end
def www_authenticate
@config['WWW-Authenticate']
end
def authorization
@config['Authorization']
end
end