public function issueAuthCode(Request $request) { $authParams = $this->service('session')->get('authParams'); $this->service('session')->remove('authParams'); $this->service('session')->remove('redirectTo'); if ($request->get('authorization') === 'Approve') { $user = $this->identityProvider->getCurrentUser(); $redirectUri = $this->server->getGrantType('authorization_code')->newAuthorizeRequest('user', $user->id, $authParams); return $this->setStatusCode(Response::HTTP_FOUND)->respond('', ['Location' => $redirectUri]); } else { $error = new AccessDeniedException(); $redirectUri = RedirectUri::make($authParams['redirect_uri'], ['error' => $error->errorType, 'message' => $error->getMessage()]); return $this->setStatusCode(Response::HTTP_FOUND)->respond('', ['Location' => $redirectUri]); } }
/** * Orchestrates the use-case of a speaker submitting a talk. * * @param TalkSubmission $submission * * @return Talk * @throws \Exception */ public function submitTalk(TalkSubmission $submission) { if (!$this->callForProposal->isOpen()) { throw new \Exception('You cannot create talks once the call for papers has ended.'); } $user = $this->identityProvider->getCurrentUser(); // Create talk from submission. $talk = $submission->toTalk(); // Own the talk to the speaker. $talk->user_id = $user->id; $this->talks->persist($talk); $this->dispatcher->dispatch('opencfp.talk.submit', new TalkWasSubmitted($talk)); return $talk; }
private function trainStudentRepositoryToThrowEntityNotFoundException() { $this->identityProvider->shouldReceive('getCurrentUser')->andThrow('OpenCFP\\Domain\\EntityNotFoundException'); }