|
7 | 7 | */ |
8 | 8 | use OC\Authentication\Token\IProvider; |
9 | 9 | use OC\User\LoginException; |
| 10 | +use OCP\Authentication\Exceptions\InvalidTokenException; |
| 11 | +use OCP\Authentication\Exceptions\WipeTokenException; |
10 | 12 | use OCP\Authentication\Token\IToken; |
11 | 13 | use OCP\EventDispatcher\IEventDispatcher; |
12 | 14 | use OCP\IGroupManager; |
13 | 15 | use OCP\ISession; |
14 | 16 | use OCP\IUser; |
15 | 17 | use OCP\IUserManager; |
16 | 18 | use OCP\Server; |
| 19 | +use OCP\Session\Exceptions\SessionNotAvailableException; |
17 | 20 | use OCP\User\Events\BeforeUserLoggedInEvent; |
18 | 21 | use OCP\User\Events\UserLoggedInEvent; |
19 | 22 | use Psr\Log\LoggerInterface; |
@@ -171,12 +174,17 @@ public static function loginWithApache(\OCP\Authentication\IApacheBackend $backe |
171 | 174 |
|
172 | 175 | if (empty($password)) { |
173 | 176 | $tokenProvider = \OC::$server->get(IProvider::class); |
174 | | - $token = $tokenProvider->getToken($userSession->getSession()->getId()); |
175 | | - $token->setScope([ |
176 | | - IToken::SCOPE_SKIP_PASSWORD_VALIDATION => true, |
177 | | - IToken::SCOPE_FILESYSTEM => true, |
178 | | - ]); |
179 | | - $tokenProvider->updateToken($token); |
| 177 | + try { |
| 178 | + $token = $tokenProvider->getToken($userSession->getSession()->getId()); |
| 179 | + $token->setScope([ |
| 180 | + IToken::SCOPE_SKIP_PASSWORD_VALIDATION => true, |
| 181 | + IToken::SCOPE_FILESYSTEM => true, |
| 182 | + ]); |
| 183 | + $tokenProvider->updateToken($token); |
| 184 | + } catch (InvalidTokenException|WipeTokenException|SessionNotAvailableException) { |
| 185 | + // swallow the exceptions as we do not deal with them here |
| 186 | + // simply skip updating the token when is it missing |
| 187 | + } |
180 | 188 | } |
181 | 189 |
|
182 | 190 | // setup the filesystem |
|
0 commit comments