File tree 1 file changed +14
-6
lines changed
1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change 38
38
39
39
use OC \Authentication \Token \IProvider ;
40
40
use OC \User \LoginException ;
41
+ use OCP \Authentication \Exceptions \InvalidTokenException ;
42
+ use OCP \Authentication \Exceptions \WipeTokenException ;
41
43
use OCP \EventDispatcher \IEventDispatcher ;
42
44
use OCP \IGroupManager ;
43
45
use OCP \ISession ;
44
46
use OCP \IUser ;
45
47
use OCP \IUserManager ;
46
48
use OCP \Server ;
49
+ use OCP \Session \Exceptions \SessionNotAvailableException ;
47
50
use OCP \User \Events \BeforeUserLoggedInEvent ;
48
51
use OCP \User \Events \UserLoggedInEvent ;
49
52
use Psr \Log \LoggerInterface ;
@@ -201,12 +204,17 @@ public static function loginWithApache(\OCP\Authentication\IApacheBackend $backe
201
204
202
205
if (empty ($ password )) {
203
206
$ tokenProvider = \OC ::$ server ->get (IProvider::class);
204
- $ token = $ tokenProvider ->getToken ($ userSession ->getSession ()->getId ());
205
- $ token ->setScope ([
206
- 'password-unconfirmable ' => true ,
207
- 'filesystem ' => true ,
208
- ]);
209
- $ tokenProvider ->updateToken ($ token );
207
+ try {
208
+ $ token = $ tokenProvider ->getToken ($ userSession ->getSession ()->getId ());
209
+ $ token ->setScope ([
210
+ 'password-unconfirmable ' => true ,
211
+ 'filesystem ' => true ,
212
+ ]);
213
+ $ tokenProvider ->updateToken ($ token );
214
+ } catch (InvalidTokenException |WipeTokenException |SessionNotAvailableException ) {
215
+ // swallow the exceptions as we do not deal with them here
216
+ // simply skip updating the token when is it missing
217
+ }
210
218
}
211
219
212
220
// setup the filesystem
You can’t perform that action at this time.
0 commit comments