Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin template strings fix #846

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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