Skip to content

Commit

Permalink
Removed error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed Feb 8, 2017
1 parent 7b4ac9a commit cac7ec3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
19 changes: 2 additions & 17 deletions src/Auth/Auth.php
Expand Up @@ -46,12 +46,10 @@ public function __invoke(Request $req, Response $res, callable $next) : Response
$oauth2Session = $this->session->getSegment('auth');

if (! empty($params['error'])) {
error_log('Parameters include an error: ' . $params['error']);
return $this->processError($params['error']);
}

if (empty($params['code'])) {
error_log('No code in query params; requesting authorization');
return $this->requestAuthorization(
$provider,
$req->getUri(),
Expand All @@ -63,11 +61,6 @@ public function __invoke(Request $req, Response $res, callable $next) : Response
if (empty($params['state'])
|| $params['state'] !== $oauth2Session->get('state')
) {
error_log(sprintf(
'Code provided, but query state ("%s") does not match session state ("%s")',
$params['state'],
$oauth2Session->get('state')
));
return $this->displayUnauthorizedPage($oauth2Session, $req, $params['redirect'] ?? '');
}

Expand All @@ -79,19 +72,11 @@ public function __invoke(Request $req, Response $res, callable $next) : Response

$user = $provider->getResourceOwner($token);
} catch (Exception $e) {
error_log(sprintf(
'Exception occurred fetching access token and/or resource owner: %s',
$e->getMessage()
));
return $this->processError($e);
}

$oauth2Session->set('user', $user->toArray());

error_log(sprintf(
'Setting user in session: %s',
var_export($user->toArray(), true)
));
$this->session->commit();

return new RedirectResponse($oauth2Session->get('redirect') ?: '/');
}
Expand All @@ -114,7 +99,7 @@ private function requestAuthorization(
Segment $session,
string $redirect
) : Response {
// Authorization URL must be generated BEFORE we retrieve the state,
// Authorization URL MUST be generated BEFORE we retrieve the state,
// as it is responsible for generating the state in the first place!
$authorizationUrl = $provider->getAuthorizationUrl();

Expand Down
2 changes: 0 additions & 2 deletions src/Auth/UserSession.php
Expand Up @@ -22,8 +22,6 @@ public function __construct(Session $session)
public function __invoke(Request $request, Response $response, callable $next) : Response
{
$auth = $this->session->getSegment('auth');
$user = $auth->get('user');
error_log(sprintf('User discovered in session: %s', var_export($user, true)));
return $next($request->withAttribute('user', $auth->get('user')), $response);
}
}

0 comments on commit cac7ec3

Please sign in to comment.