@@ -60,6 +60,7 @@ def authentication():
6060 raise common_errors .ResourceError ("The endpoint and HTTP method combination "
6161 "are not available from this service." )
6262
63+
6364 # the metadata endpoint is publicly available
6465 if '/v3/oauth2/.well-known/' in request .url_rule .rule :
6566 logger .debug (".well-known endpoint; request is allowed to be made unauthenticated." )
@@ -82,7 +83,7 @@ def authentication():
8283 # first, make sure this request is for a tenant served by this authenticator
8384 if g .request_tenant_id not in conf .tenants :
8485 raise common_errors .PermissionsError (f"The request is for a tenant ({ g .request_tenant_id } ) that is not "
85- f"served by this authenticator." )
86+ f"served by this authenticator." )
8687 # we only want to honor tokens from THIS authenticator; i.e., not some other authenticator. therefore, we need
8788 # to check that the tenant_id associated with the token (g.tenant_id) is the same as THIS authenticator's tenant
8889 # id;
@@ -91,28 +92,28 @@ def authentication():
9192 f"and tenant was { conf .service_tenant_id } " )
9293 return True
9394 logger .debug (f"request token does not represent THIS authenticator: token username: { g .username } ;"
94- f" request tenant: { g .tenant_id } . Now checking for tenant admin..." )
95+ f" request tenant: { g .tenant_id } . Now checking for tenant admin..." )
9596 # all other service accounts are not allowed to update authenticator
9697 if g .account_type == 'service' :
9798 raise common_errors .PermissionsError ("Not authorized -- service accounts are not allowed to access the"
98- "authenticator admin endpoints." )
99+ "authenticator admin endpoints." )
99100 # sanity check -- the request tenant id should be the same as the token tenant id in the remaining cases because
100101 # they are all user tokens
101102 if not g .request_tenant_id == g .tenant_id :
102103 logger .error (f"program error -- g.request_tenant_id: { g .request_tenant_id } not equal to "
103- f"g.tenant_id: { g .tenant_id } even though account type was user!" )
104+ f"g.tenant_id: { g .tenant_id } even though account type was user!" )
104105 raise common_errors .ServiceConfigError (f"Unexpected program error checking permissions. The tenant id of"
105- f"the request ({ g .request_tenant_id } ) did not match the tenant id "
106- f"of the access token ({ g .tenant_id } ). Please contact server "
107- f"administrators." )
106+ f"the request ({ g .request_tenant_id } ) did not match the tenant id "
107+ f"of the access token ({ g .tenant_id } ). Please contact server "
108+ f"administrators." )
108109 # check SK for tenant admin --
109110 try :
110111 rsp = t .sk .isAdmin (tenant = g .tenant_id , user = g .username )
111112 except Exception as e :
112113 logger .error (f"Got exception trying to check tenant admin role for tenant: { g .tenant_id } "
113- f"and user: { g .username } ; exception: { e } " )
114+ f"and user: { g .username } ; exception: { e } " )
114115 raise common_errors .PermissionsError ("Could not check tenant admin role with SK; this role is required for "
115- "accessing the authenticator admin endpoints." )
116+ "accessing the authenticator admin endpoints." )
116117 try :
117118 if rsp .isAuthorized :
118119 logger .info (f"user { g .username } had tenant admin role for tenant { g .tenant_id } ; allowing request." )
@@ -121,14 +122,14 @@ def authentication():
121122 logger .info (f"user { g .username } DID NOT have tenant admin role for tenant { g .tenant_id } ; "
122123 f"NOT allowing request." )
123124 raise common_errors .PermissionsError ("Permission denied -- Tenant admin role required for accessing "
124- "the authenticator admin endpoints." )
125+ "the authenticator admin endpoints." )
125126 except Exception as e :
126127 logger .error (f"got exception trying to check isAuthorized property from isAdmin() call to SK."
127- f"username: { g .username } ; tenant: { g .tenant_id } ; rsp: { rsp } ; e: { e } " )
128+ f"username: { g .username } ; tenant: { g .tenant_id } ; rsp: { rsp } ; e: { e } " )
128129 logger .info (f"user { g .username } DID NOT have tenant admin role for tenant { g .tenant_id } ; "
129130 f"NOT allowing request." )
130131 raise common_errors .PermissionsError ("Permission denied -- Tenant admin role required for accessing the "
131- "authenticator admin endpoints." )
132+ "authenticator admin endpoints." )
132133
133134 # no credentials required on the authorize, login and oa2 extension pages
134135 if '/v3/oauth2/authorize' in request .url_rule .rule or '/v3/oauth2/login' in request .url_rule .rule \
@@ -144,7 +145,7 @@ def authentication():
144145 # make sure this request is for a tenant served by this authenticator
145146 if g .request_tenant_id not in conf .tenants :
146147 raise common_errors .PermissionsError (f"The request is for a tenant ({ g .request_tenant_id } ) that is not "
147- f"served by this authenticator." )
148+ f"served by this authenticator." )
148149 return True
149150
150151 # the profiles endpoints always use standard Tapis Token auth -
@@ -156,7 +157,7 @@ def authentication():
156157 # make sure this request is for a tenant served by this authenticator
157158 if g .request_tenant_id not in conf .tenants :
158159 raise common_errors .PermissionsError (f"The request is for a tenant ({ g .request_tenant_id } ) that is not "
159- f"served by this authenticator." )
160+ f"served by this authenticator." )
160161 return True
161162
162163 # the clients endpoints need to accept both standard Tapis Token auth and basic auth,
@@ -244,7 +245,7 @@ def authentication():
244245 # make sure this request is for a tenant served by this authenticator
245246 if g .request_tenant_id not in conf .tenants :
246247 raise common_errors .PermissionsError (f"The request is for a tenant ({ g .request_tenant_id } ) that is not "
247- f"served by this authenticator." )
248+ f"served by this authenticator." )
248249 return True
249250
250251 # Special v3->v2 token generation endpoint.
0 commit comments