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 3737 */
3838use OC \Authentication \Token \IProvider ;
3939use OC \User \LoginException ;
40+ use OCP \Authentication \Exceptions \InvalidTokenException ;
41+ use OCP \Authentication \Exceptions \WipeTokenException ;
4042use OCP \EventDispatcher \IEventDispatcher ;
4143use OCP \ILogger ;
4244use OCP \ISession ;
4345use OCP \IUserManager ;
4446use OCP \Server ;
47+ use OCP \Session \Exceptions \SessionNotAvailableException ;
4548use OCP \User \Events \BeforeUserLoggedInEvent ;
4649use OCP \User \Events \UserLoggedInEvent ;
4750
@@ -198,12 +201,17 @@ public static function loginWithApache(\OCP\Authentication\IApacheBackend $backe
198201
199202 if (empty ($ password )) {
200203 $ tokenProvider = \OC ::$ server ->get (IProvider::class);
201- $ token = $ tokenProvider ->getToken ($ userSession ->getSession ()->getId ());
202- $ token ->setScope ([
203- 'password-unconfirmable ' => true ,
204- 'filesystem ' => true ,
205- ]);
206- $ tokenProvider ->updateToken ($ token );
204+ try {
205+ $ token = $ tokenProvider ->getToken ($ userSession ->getSession ()->getId ());
206+ $ token ->setScope ([
207+ 'password-unconfirmable ' => true ,
208+ 'filesystem ' => true ,
209+ ]);
210+ $ tokenProvider ->updateToken ($ token );
211+ } catch (InvalidTokenException |WipeTokenException |SessionNotAvailableException ) {
212+ // swallow the exceptions as we do not deal with them here
213+ // simply skip updating the token when is it missing
214+ }
207215 }
208216
209217 // setup the filesystem
You can’t perform that action at this time.
0 commit comments