Skip to content

Commit 1f27b18

Browse files
committed
Merge branch '5.8.x' into 6.0.x
2 parents c4b773b + e8b9a35 commit 1f27b18

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

docs/modules/ROOT/pages/servlet/oauth2/resource-server/bearer-tokens.adoc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,16 +241,15 @@ fun rest(): RestTemplate {
241241
val rest = RestTemplate()
242242
rest.interceptors.add(ClientHttpRequestInterceptor { request, body, execution ->
243243
val authentication: Authentication? = SecurityContextHolder.getContext().authentication
244-
if (authentication != null) {
245-
execution.execute(request, body)
244+
if (authentication == null) {
245+
return execution.execute(request, body)
246246
}
247247
248-
if (authentication!!.credentials !is AbstractOAuth2Token) {
249-
execution.execute(request, body)
248+
if (authentication.credentials !is AbstractOAuth2Token) {
249+
return execution.execute(request, body)
250250
}
251251
252-
val token: AbstractOAuth2Token = authentication.credentials as AbstractOAuth2Token
253-
request.headers.setBearerAuth(token.tokenValue)
252+
request.headers.setBearerAuth(authentication.credentials.tokenValue)
254253
execution.execute(request, body)
255254
})
256255
return rest

0 commit comments

Comments
 (0)