File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
play2-oauth2-provider/src/main/scala/scalaoauth2/provider Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -120,8 +120,7 @@ trait OAuth2Provider extends OAuth2BaseProvider {
120120 */
121121 def issueAccessToken [A , U ](handler : AuthorizationHandler [U ])(implicit request : Request [A ], ctx : ExecutionContext ): Future [Result ] = {
122122 tokenEndpoint.handleRequest(request, handler).map {
123- case Left (e) if e.statusCode == 400 => BadRequest (responseOAuthErrorJson(e)).withHeaders(responseOAuthErrorHeader(e))
124- case Left (e) if e.statusCode == 401 => Unauthorized (responseOAuthErrorJson(e)).withHeaders(responseOAuthErrorHeader(e))
123+ case Left (e) => new Status (e.statusCode)(responseOAuthErrorJson(e)).withHeaders(responseOAuthErrorHeader(e))
125124 case Right (r) => Ok (Json .toJson(responseAccessToken(r))).withHeaders(" Cache-Control" -> " no-store" , " Pragma" -> " no-cache" )
126125 }
127126 }
@@ -140,8 +139,7 @@ trait OAuth2Provider extends OAuth2BaseProvider {
140139 */
141140 def authorize [A , U ](handler : ProtectedResourceHandler [U ])(callback : AuthInfo [U ] => Future [Result ])(implicit request : Request [A ], ctx : ExecutionContext ): Future [Result ] = {
142141 protectedResource.handleRequest(request, handler).flatMap {
143- case Left (e) if e.statusCode == 400 => Future .successful(BadRequest .withHeaders(responseOAuthErrorHeader(e)))
144- case Left (e) if e.statusCode == 401 => Future .successful(Unauthorized .withHeaders(responseOAuthErrorHeader(e)))
142+ case Left (e) => Future .successful(new Status (e.statusCode).withHeaders(responseOAuthErrorHeader(e)))
145143 case Right (authInfo) => callback(authInfo)
146144 }
147145 }
You can’t perform that action at this time.
0 commit comments