File tree Expand file tree Collapse file tree 4 files changed +55
-1
lines changed Expand file tree Collapse file tree 4 files changed +55
-1
lines changed Original file line number Diff line number Diff line change 3
3
from cryptojwt .utils import importer
4
4
5
5
from idpyoidc .client .client_auth import CLIENT_AUTHN_METHOD
6
+ from idpyoidc .client .service import Service
6
7
from idpyoidc .message import Message
7
8
from idpyoidc .message .oauth2 import JWTSecuredAuthorizationRequest
8
9
from idpyoidc .server .util import execute
13
14
HTTP_METHOD = "POST"
14
15
15
16
16
- def push_authorization (request_args , service , ** kwargs ):
17
+ def push_authorization (request_args : Message , service : Service , ** kwargs ):
17
18
"""
18
19
:param request_args: All the request arguments as a AuthorizationRequest instance
19
20
:param service: The service to which this post construct method is applied.
Original file line number Diff line number Diff line change @@ -271,6 +271,11 @@ def get_deserialization_method(reqresp):
271
271
return "jwt"
272
272
except Exception :
273
273
return "urlencoded" # reasonable default ??
274
+ elif ';' in _ctype :
275
+ for _typ in _ctype .split (";" ):
276
+ if _typ .startswith ("application" ) or _typ .startswith ("text" ):
277
+ _ctype = _typ
278
+ break
274
279
275
280
if match_to_ ("application/json" , _ctype ) or match_to_ ("application/jrd+json" , _ctype ):
276
281
deser_method = "json"
Original file line number Diff line number Diff line change @@ -239,6 +239,14 @@ def synch(self):
239
239
else :
240
240
self .fmtime [f ] = mtime
241
241
242
+ _keys = self .storage .keys ()
243
+ for f in _keys :
244
+ fname = os .path .join (self .fdir , f )
245
+ if os .path .isfile (fname ):
246
+ pass
247
+ else :
248
+ del self .storage [f ]
249
+
242
250
def items (self ):
243
251
"""
244
252
Implements the dict.items() method
Original file line number Diff line number Diff line change @@ -137,3 +137,43 @@ def _read_info(self, fname):
137
137
138
138
def __call__ (self ):
139
139
return self ._read_info (self .file_name )
140
+
141
+ class ReadWriteListFile (object ):
142
+
143
+ def __init__ (self , file_name ):
144
+ self .file_name = file_name
145
+
146
+ if not os .path .exists (file_name ):
147
+ fp = open (file_name , "x" )
148
+ fp .close ()
149
+
150
+ def __contains__ (self , item ):
151
+ _lst = self ._read_info (self .file_name )
152
+ return item in _lst
153
+
154
+ def __len__ (self ):
155
+ _lst = self ._read_info (self .file_name )
156
+ if _lst is None or _lst == []:
157
+ return 0
158
+
159
+ return len (_lst )
160
+
161
+ def _read_info (self , fname ):
162
+ if os .path .isfile (fname ):
163
+ try :
164
+ lock = FileLock (f"{ fname } .lock" )
165
+ with lock :
166
+ fp = open (fname , "r" )
167
+ info = [x .strip () for x in fp .readlines ()]
168
+ lock .release ()
169
+ return info or None
170
+ except Exception as err :
171
+ logger .error (err )
172
+ raise
173
+ else :
174
+ _msg = f"No such file: '{ fname } '"
175
+ logger .error (_msg )
176
+ return None
177
+
178
+ def __call__ (self ):
179
+ return self ._read_info (self .file_name )
You can’t perform that action at this time.
0 commit comments