Skip to content

Commit c0e9afc

Browse files
committedAug 6, 2018
Added more comments
1 parent b6ba746 commit c0e9afc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
 

‎auth/x509_auth.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def strip_end(string, suffix):
4545
return string
4646

4747

48+
# a class that loads the JSON configution file that details the authorisation info for paths
49+
# this is called during the initialisation of the module
4850
class _AuthJSON(object):
4951
auth_dict = {}
5052
path_list = []
@@ -88,6 +90,7 @@ def auth_info_for_path(self, path):
8890
myauthjson = _AuthJSON()
8991

9092

93+
# given a authorisation condition and the user's clientname, does the user satisfy the condition?
9194
# return true or false based on condition
9295
def process_condition(condition, clientname):
9396
# empty list = don't check any attributes, so auto match
@@ -127,7 +130,11 @@ def process_condition(condition, clientname):
127130
def isallowed(clientname="unknown", remoteaddr="nowhere", resource="none", mode="0", fqans=None, keys=None):
128131
result = myauthjson.auth_info_for_path(resource)
129132
if result is None:
130-
# failed to match anything
133+
# failed to match anything, means the path isn't supposed protected by this plugin
134+
135+
# shouldn't really happen, as usually the base path at least will be specified
136+
# unless there are mutiple auth plugins and you want to reduce repetition of granting
137+
# things on base path
131138
return 1
132139

133140
auth_info = result["auth_info"]

0 commit comments

Comments
 (0)
Please sign in to comment.