@@ -85,12 +85,7 @@ state=1234567890
85
85
Route::get('/oauth/authorize', array('before' => 'check-authorization-params|auth', function()
86
86
{
87
87
// get the data from the check-authorization-params filter
88
- $params['client_id'] = Session::get('client_id');
89
- $params['client_details'] = Session::get('client_details');
90
- $params['redirect_uri'] = Session::get('redirect_uri');
91
- $params['response_type'] = Session::get('response_type');
92
- $params['scopes'] = Session::get('scopes');
93
- $params['state'] = Session::get('state');
88
+ $params = Session::get('authorize-params');
94
89
95
90
// get the user id
96
91
$params['user_id'] = Auth::user()->id;
@@ -104,46 +99,26 @@ Route::get('/oauth/authorize', array('before' => 'check-authorization-params|aut
104
99
Route::post('/oauth/authorize', array('before' => 'check-authorization-params|auth|csrf', function()
105
100
{
106
101
// get the data from the check-authorization-params filter
107
- $params['client_id'] = Session::get('client_id');
108
- $params['client_details'] = Session::get('client_details');
109
- $params['redirect_uri'] = Session::get('redirect_uri');
110
- $params['response_type'] = Session::get('response_type');
111
- $params['scopes'] = Session::get('scopes');
112
- $params['state'] = Session::get('state');
102
+ $params = Session::get('authorize-params')
113
103
114
104
// get the user id
115
105
$params['user_id'] = Auth::user()->id;
116
106
117
107
// check if the user approved or denied the authorization request
118
108
if (Input::get('approve') !== null) {
119
109
120
- $code = AuthorizationServer::getGrantType('authorization_code')->newAuthoriseRequest ('user', $params['user_id'], $params);
110
+ $code = AuthorizationServer::newAuthorizeRequest ('user', $params['user_id'], $params);
121
111
122
- // not appropriate
123
- Session::flush();
112
+ Session::forget('authorize-params');
124
113
125
- return Redirect::to(
126
- AuthorizationServer::makeRedirect($params['redirect_uri'],
127
- array(
128
- 'code' => $code,
129
- 'state' => isset($params['state']) ? $params['state'] : ''
130
- )
131
- ));
114
+ return Redirect::to(AuthorizationServer::makeRedirectWithCode($code, $params));
132
115
}
133
116
134
117
if (Input::get('deny') !== null) {
135
118
136
- // just for demonstration purposes (you should flush the vars individually)
137
- Session::flush();
119
+ Session::forget('authorize-params');
138
120
139
- return Redirect::to(
140
- AuthorizationServer::makeRedirect($params['redirect_uri'],
141
- array(
142
- 'error' => 'access_denied',
143
- 'error_message' => AuthorizationServer::getExceptionMessage('access_denied'),
144
- 'state' => isset($params['state']) ? $params['state'] : ''
145
- )
146
- ));
121
+ return Redirect::to(AuthorizationServer::makeRedirectWithError($params));
147
122
}
148
123
});
149
124
```
0 commit comments