Skip to content

Commit

Permalink
Kotlin template strings fix (#846)
Browse files Browse the repository at this point in the history
* Fixed template strings

* typo
  • Loading branch information
blommish authored Feb 13, 2024
1 parent 9472c8f commit 3675849
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ open class DefaultOAuth2HttpClient(val restClient: RestClient) : OAuth2HttpClien
setAll(req.formParameters)
}).retrieve()
.onStatus({ it.isError }) { _, response ->
throw OAuth2ClientException("Received $response.statusCode from $req.tokenEndpointUrl")
throw OAuth2ClientException("Received ${response.statusCode} from ${req.tokenEndpointUrl}")
}
.body<OAuth2AccessTokenResponse>() ?: throw OAuth2ClientException("No body in response from $req.tokenEndpointUrl")
.body<OAuth2AccessTokenResponse>() ?: throw OAuth2ClientException("No body in response from ${req.tokenEndpointUrl}")

private fun headers(req: OAuth2HttpRequest): HttpHeaders = HttpHeaders().apply { putAll(req.oAuth2HttpHeaders.headers) }

override fun toString() = "$javaClass.simpleName [restClient=$restClient]"
override fun toString() = "${javaClass.simpleName} [restClient=$restClient]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import no.nav.security.token.support.core.context.TokenValidationContextHolder
class OAuth2ClientConfiguration : ImportAware {
private var attrs: AnnotationAttributes? = null
override fun setImportMetadata(meta: AnnotationMetadata) {
attrs = requireNotNull(fromMap(meta.getAnnotationAttributes(EnableOAuth2Client::class.java.name, false))) { "@EnableOAuth2Client is not present on importing class $meta.className" }
attrs = requireNotNull(fromMap(meta.getAnnotationAttributes(EnableOAuth2Client::class.java.name, false))) { "@EnableOAuth2Client is not present on importing class ${meta.className}" }
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ class OAuth2ClientRequestInterceptor(private val properties: ClientConfiguration
return execution.execute(req, body)
}

override fun toString() = "$javaClass.simpleName [properties=$properties, service=$service, matcher=$matcher]"
override fun toString() = "${javaClass.simpleName} [properties=$properties, service=$service, matcher=$matcher]"

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class IssuerProperties @JvmOverloads constructor(val discoveryUrl : URL,
val usePlaintextForHttps: Boolean = false) {

init {
cookieName?.let { throw IllegalArgumentException("Cookie-support is discontinued, please remove $it from ypur configuration now") }
cookieName?.let { throw IllegalArgumentException("Cookie-support is discontinued, please remove $it from your configuration now") }
}

override fun toString() = "IssuerProperties(discoveryUrl=$discoveryUrl, acceptedAudience=$acceptedAudience, headerName=$headerName, proxyUrl=$proxyUrl, usePlaintextForHttps=$usePlaintextForHttps, validation=$validation, jwksCache=$jwksCache)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class EnableJwtTokenValidationConfiguration (private val env: Environment) : Web
}

override fun setImportMetadata(meta: AnnotationMetadata) {
attrs = fromMap(meta.getAnnotationAttributes(EnableJwtTokenValidation::class.java.name, false)) ?: throw IllegalArgumentException("@EnableJwtTokenValidation is not present on importing class $meta.className")
attrs = fromMap(meta.getAnnotationAttributes(EnableJwtTokenValidation::class.java.name, false)) ?: throw IllegalArgumentException("@EnableJwtTokenValidation is not present on importing class ${meta.className}")
}

//TO-DO remove support for global proxy - should be set per issuer config
Expand Down

0 comments on commit 3675849

Please sign in to comment.