File tree 4 files changed +2
-64
lines changed
4 files changed +2
-64
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class CheckClientCredentials extends CheckCredentials
16
16
*/
17
17
protected function validateCredentials ($ token )
18
18
{
19
- if (! $ token || $ token -> client -> firstParty () ) {
19
+ if (! $ token ) {
20
20
throw new AuthenticationException ;
21
21
}
22
22
}
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class CheckClientCredentialsForAnyScope extends CheckCredentials
16
16
*/
17
17
protected function validateCredentials ($ token )
18
18
{
19
- if (! $ token || $ token -> client -> firstParty () ) {
19
+ if (! $ token ) {
20
20
throw new AuthenticationException ;
21
21
}
22
22
}
Original file line number Diff line number Diff line change @@ -137,35 +137,4 @@ public function test_exception_is_thrown_if_token_does_not_have_required_scope()
137
137
return 'response ' ;
138
138
}, 'baz ' , 'notbar ' );
139
139
}
140
-
141
- /**
142
- * @expectedException \Illuminate\Auth\AuthenticationException
143
- */
144
- public function test_exception_is_thrown_if_token_belongs_to_first_party_client ()
145
- {
146
- $ resourceServer = m::mock (ResourceServer::class);
147
- $ resourceServer ->shouldReceive ('validateAuthenticatedRequest ' )->andReturn ($ psr = m::mock ());
148
- $ psr ->shouldReceive ('getAttribute ' )->with ('oauth_user_id ' )->andReturn (1 );
149
- $ psr ->shouldReceive ('getAttribute ' )->with ('oauth_client_id ' )->andReturn (1 );
150
- $ psr ->shouldReceive ('getAttribute ' )->with ('oauth_access_token_id ' )->andReturn ('token ' );
151
- $ psr ->shouldReceive ('getAttribute ' )->with ('oauth_scopes ' )->andReturn (['* ' ]);
152
-
153
- $ client = m::mock (Client::class);
154
- $ client ->shouldReceive ('firstParty ' )->andReturnTrue ();
155
-
156
- $ token = m::mock (Token::class);
157
- $ token ->shouldReceive ('getAttribute ' )->with ('client ' )->andReturn ($ client );
158
-
159
- $ tokenRepository = m::mock (TokenRepository::class);
160
- $ tokenRepository ->shouldReceive ('find ' )->with ('token ' )->andReturn ($ token );
161
-
162
- $ middleware = new CheckClientCredentialsForAnyScope ($ resourceServer , $ tokenRepository );
163
-
164
- $ request = Request::create ('/ ' );
165
- $ request ->headers ->set ('Authorization ' , 'Bearer token ' );
166
-
167
- $ response = $ middleware ->handle ($ request , function () {
168
- return 'response ' ;
169
- });
170
- }
171
140
}
Original file line number Diff line number Diff line change @@ -136,35 +136,4 @@ public function test_exception_is_thrown_if_token_does_not_have_required_scopes(
136
136
return 'response ' ;
137
137
}, 'foo ' , 'bar ' );
138
138
}
139
-
140
- /**
141
- * @expectedException \Illuminate\Auth\AuthenticationException
142
- */
143
- public function test_exception_is_thrown_if_token_belongs_to_first_party_client ()
144
- {
145
- $ resourceServer = m::mock (ResourceServer::class);
146
- $ resourceServer ->shouldReceive ('validateAuthenticatedRequest ' )->andReturn ($ psr = m::mock ());
147
- $ psr ->shouldReceive ('getAttribute ' )->with ('oauth_user_id ' )->andReturn (1 );
148
- $ psr ->shouldReceive ('getAttribute ' )->with ('oauth_client_id ' )->andReturn (1 );
149
- $ psr ->shouldReceive ('getAttribute ' )->with ('oauth_access_token_id ' )->andReturn ('token ' );
150
- $ psr ->shouldReceive ('getAttribute ' )->with ('oauth_scopes ' )->andReturn (['* ' ]);
151
-
152
- $ client = m::mock (Client::class);
153
- $ client ->shouldReceive ('firstParty ' )->andReturnTrue ();
154
-
155
- $ token = m::mock (Token::class);
156
- $ token ->shouldReceive ('getAttribute ' )->with ('client ' )->andReturn ($ client );
157
-
158
- $ tokenRepository = m::mock (TokenRepository::class);
159
- $ tokenRepository ->shouldReceive ('find ' )->with ('token ' )->andReturn ($ token );
160
-
161
- $ middleware = new CheckClientCredentials ($ resourceServer , $ tokenRepository );
162
-
163
- $ request = Request::create ('/ ' );
164
- $ request ->headers ->set ('Authorization ' , 'Bearer token ' );
165
-
166
- $ response = $ middleware ->handle ($ request , function () {
167
- return 'response ' ;
168
- });
169
- }
170
139
}
You can’t perform that action at this time.
0 commit comments