Example #1
0
 /**
  * Perform resource owner authorization wheter approve or deny
  * @param  Authorizer $authorizer
  * @param  Guard      $auth
  * @param  Request    $request
  * @return Redirect response
  */
 public function postAuthorization(Authorizer $authorizer, Guard $auth, Request $request)
 {
     $params = $authorizer->getAuthCodeRequestParams();
     $params['user_id'] = $auth->user()->id;
     $redirectUri = '';
     // if the user has allowed the client to access its data, redirect back to the client with an auth code
     if ($request->input('approve') !== null) {
         $redirectUri = $authorizer->issueAuthCode('user', $params['user_id'], $params);
     }
     // if the user has denied the client to access its data, redirect back to the client with an error message
     if ($request->input('deny') !== null) {
         $redirectUri = $authorizer->authCodeRequestDeniedRedirectUri();
     }
     return redirect($redirectUri);
 }
Example #2
0
 /**
  * Get the Auth Code request parameters.
  *
  * @return array 
  * @static 
  */
 public static function getAuthCodeRequestParams()
 {
     return \LucaDegasperi\OAuth2Server\Authorizer::getAuthCodeRequestParams();
 }