Skip to content

Commit

Permalink
Merge pull request #40830 from nextcloud/stable27-cors-app_api
Browse files Browse the repository at this point in the history
[stable27] added CORS skip if session was created by AppAPI
  • Loading branch information
blizzz authored Oct 9, 2023
2 parents 7396412 + 4623fd1 commit 9714f03
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Middleware;
use OCP\IRequest;
use OCP\ISession;
use ReflectionMethod;

/**
Expand Down Expand Up @@ -97,6 +98,10 @@ public function beforeController($controller, $methodName) {
if ($this->request->passesCSRFCheck()) {
return;
}
// Skip CORS check for requests with AppAPI auth.
if ($this->session->getSession() instanceof ISession && $this->session->getSession()->get('app_api') === true) {
return;
}
$this->session->logout();
try {
if ($user === null || $pass === null || !$this->session->logClientIn($user, $pass, $this->request, $this->throttler)) {
Expand Down

0 comments on commit 9714f03

Please sign in to comment.