diff --git a/cosec-core/src/main/kotlin/me/ahoo/cosec/context/request/XForwardedRemoteIpResolver.kt b/cosec-core/src/main/kotlin/me/ahoo/cosec/context/request/XForwardedRemoteIpResolver.kt index 238a74ff..799b012c 100644 --- a/cosec-core/src/main/kotlin/me/ahoo/cosec/context/request/XForwardedRemoteIpResolver.kt +++ b/cosec-core/src/main/kotlin/me/ahoo/cosec/context/request/XForwardedRemoteIpResolver.kt @@ -46,7 +46,7 @@ abstract class XForwardedRemoteIpResolver( val xForwardedValues = xForwardedHeaderValues[0] .split(DELIMITER) - .dropWhile { it.isBlank() } + .filter { it.isNotBlank() } .reversed() if (xForwardedValues.isEmpty()) { return defaultRemoteIpResolver.resolve(request) diff --git a/cosec-core/src/test/kotlin/me/ahoo/cosec/policy/condition/part/DefaultPartExtractorTest.kt b/cosec-core/src/test/kotlin/me/ahoo/cosec/policy/condition/part/DefaultPartExtractorTest.kt index a83b6a9b..83ff6ee1 100644 --- a/cosec-core/src/test/kotlin/me/ahoo/cosec/policy/condition/part/DefaultPartExtractorTest.kt +++ b/cosec-core/src/test/kotlin/me/ahoo/cosec/policy/condition/part/DefaultPartExtractorTest.kt @@ -104,7 +104,7 @@ class DefaultPartExtractorTest { DefaultPartExtractor(SecurityContextParts.PRINCIPAL_ATTRIBUTES_PREFIX + "key").extract(mockk(), context), equalTo("value") ) - assertThat( + assertThat( DefaultPartExtractor(SecurityContextParts.PRINCIPAL_ATTRIBUTES_PREFIX + "not_exist").extract(mockk(), context), equalTo("") ) diff --git a/cosec-webflux/src/main/kotlin/me/ahoo/cosec/webflux/ReactiveRequestParser.kt b/cosec-webflux/src/main/kotlin/me/ahoo/cosec/webflux/ReactiveRequestParser.kt index b5bb7da9..ba75659e 100644 --- a/cosec-webflux/src/main/kotlin/me/ahoo/cosec/webflux/ReactiveRequestParser.kt +++ b/cosec-webflux/src/main/kotlin/me/ahoo/cosec/webflux/ReactiveRequestParser.kt @@ -20,7 +20,7 @@ import org.springframework.http.HttpHeaders import org.springframework.web.server.ServerWebExchange class ReactiveRequestParser( - private val remoteIPResolver: RemoteIpResolver + private val remoteIpResolver: RemoteIpResolver ) : RequestParser { override fun parse(request: ServerWebExchange): Request { @@ -28,7 +28,7 @@ class ReactiveRequestParser( delegate = request, path = request.request.path.value(), method = request.request.methodValue, - remoteIp = remoteIPResolver.resolve(request), + remoteIp = remoteIpResolver.resolve(request), origin = request.request.headers.origin.orEmpty(), referer = request.request.headers.getFirst(HttpHeaders.REFERER).orEmpty() ) diff --git a/gradle.properties b/gradle.properties index 8711f611..52896b1e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,7 +11,7 @@ # limitations under the License. # group=me.ahoo.cosec -version=1.8.5 +version=1.8.6 description=RBAC-based And Policy-based Multi-Tenant Reactive Security Framework website=https://github.com/Ahoo-Wang/CoSec issues=https://github.com/Ahoo-Wang/CoSec/issues