Skip to content

Commit 6bf8d21

Browse files
author
Doug Stevenson
committed
The authorization server MUST include the HTTP "Cache-Control" response header field [RFC2616] with a value of "no-store" in any response containing tokens, credentials, or other sensitive information, as well as the "Pragma" response header field [RFC2616] with a value of "no-cache".
1 parent a2a4537 commit 6bf8d21

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

play2-oauth2-provider/src/main/scala/scalaoauth2/provider/OAuth2Provider.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ trait OAuth2Provider extends OAuth2BaseProvider {
114114
TokenEndpoint.handleRequest(request, dataHandler) match {
115115
case Left(e) if e.statusCode == 400 => BadRequest(responseOAuthErrorJson(e)).withHeaders(responseOAuthErrorHeader(e))
116116
case Left(e) if e.statusCode == 401 => Unauthorized(responseOAuthErrorJson(e)).withHeaders(responseOAuthErrorHeader(e))
117-
case Right(r) => Ok(Json.toJson(responseAccessToken(r)))
117+
case Right(r) => Ok(Json.toJson(responseAccessToken(r))).withHeaders("Cache-Control" -> "no-store", "Pragma" -> "no-cache")
118118
}
119119
}
120120

@@ -185,7 +185,7 @@ trait OAuth2AsyncProvider extends OAuth2BaseProvider {
185185
TokenEndpoint.handleRequest(request, dataHandler) match {
186186
case Left(e) if e.statusCode == 400 => Future.successful(BadRequest(responseOAuthErrorJson(e)).withHeaders(responseOAuthErrorHeader(e)))
187187
case Left(e) if e.statusCode == 401 => Future.successful(Unauthorized(responseOAuthErrorJson(e)).withHeaders(responseOAuthErrorHeader(e)))
188-
case Right(r) => Future.successful(Ok(Json.toJson(responseAccessToken(r))))
188+
case Right(r) => Future.successful(Ok(Json.toJson(responseAccessToken(r))).withHeaders("Cache-Control" -> "no-store", "Pragma" -> "no-cache"))
189189
}
190190
}
191191

0 commit comments

Comments
 (0)