File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change 3838
3939use OC \Authentication \Token \IProvider ;
4040use OC \User \LoginException ;
41+ use OCP \Authentication \Exceptions \InvalidTokenException ;
42+ use OCP \Authentication \Exceptions \WipeTokenException ;
4143use OCP \EventDispatcher \IEventDispatcher ;
4244use OCP \IGroupManager ;
4345use OCP \ISession ;
4446use OCP \IUser ;
4547use OCP \IUserManager ;
4648use OCP \Server ;
49+ use OCP \Session \Exceptions \SessionNotAvailableException ;
4750use OCP \User \Events \BeforeUserLoggedInEvent ;
4851use OCP \User \Events \UserLoggedInEvent ;
4952use Psr \Log \LoggerInterface ;
@@ -201,12 +204,17 @@ public static function loginWithApache(\OCP\Authentication\IApacheBackend $backe
201204
202205 if (empty ($ password )) {
203206 $ 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+ }
210218 }
211219
212220 // setup the filesystem
You can’t perform that action at this time.
0 commit comments