Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2c1d1ea49
|
||
|
|
aaec4e940a
|
||
|
|
a02dfa100c
|
||
|
|
0082305a5a
|
||
|
|
11345c94a5
|
+1
-1
@@ -124,7 +124,7 @@ steps:
|
|||||||
- mkdir $HOME/bin
|
- mkdir $HOME/bin
|
||||||
- wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_arm64 -O $HOME/bin/yq && chmod +x $HOME/bin/yq
|
- wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_arm64 -O $HOME/bin/yq && chmod +x $HOME/bin/yq
|
||||||
- sed -i -r "s/(tag:).*/\1\ \"${DRONE_SEMVER}\"/" argocd/wahlrecht/${DRONE_DEPLOY_TO}/overwrite_values.yaml
|
- sed -i -r "s/(tag:).*/\1\ \"${DRONE_SEMVER}\"/" argocd/wahlrecht/${DRONE_DEPLOY_TO}/overwrite_values.yaml
|
||||||
- cd argocd/configserver/${DRONE_DEPLOY_TO} && $HOME/bin/yq '. *= load("overwrite_values.yaml")' default_values.yaml > values.yaml
|
- cd argocd/wahlrecht/${DRONE_DEPLOY_TO} && $HOME/bin/yq '. *= load("overwrite_values.yaml")' default_values.yaml > values.yaml
|
||||||
- name: save modified variable file
|
- name: save modified variable file
|
||||||
image: alpine/git
|
image: alpine/git
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
+12
-12
@@ -1,21 +1,21 @@
|
|||||||
[versions]
|
[versions]
|
||||||
spring-boot = "3.1.2"
|
spring-boot = "3.2.3"
|
||||||
spring-doc = "2.1.0"
|
spring-doc = "2.3.0"
|
||||||
spring-cloud = "2022.0.4"
|
spring-cloud = "2023.0.0"
|
||||||
spring-grpc = "2.14.0.RELEASE"
|
spring-grpc = "2.14.0.RELEASE"
|
||||||
grpc = "1.57.0"
|
grpc = "1.57.0"
|
||||||
tomcat-annotations = "6.0.53"
|
tomcat-annotations = "6.0.53"
|
||||||
httpclient = "5.2.1"
|
httpclient = "5.3.1"
|
||||||
slf4j = "2.0.7"
|
slf4j = "2.0.12"
|
||||||
log4j = "2.20.0"
|
log4j = "2.23.0"
|
||||||
log4j-ecs = "1.5.0"
|
log4j-ecs = "1.6.0"
|
||||||
mapstruct = "1.5.5.Final"
|
mapstruct = "1.5.5.Final"
|
||||||
junit = "5.10.0"
|
junit = "5.10.2"
|
||||||
assertj = "3.24.2"
|
assertj = "3.25.3"
|
||||||
mockito = "5.4.0"
|
mockito = "5.11.0"
|
||||||
keycloak = "22.0.1"
|
keycloak = "24.0.1"
|
||||||
kotlin-logging = "3.0.5"
|
kotlin-logging = "3.0.5"
|
||||||
kotlin-reflect = "1.9.0"
|
kotlin-reflect = "1.9.22"
|
||||||
kotlin-lombok = "1.9.0"
|
kotlin-lombok = "1.9.0"
|
||||||
plugin-nebula-release = "17.2.2"
|
plugin-nebula-release = "17.2.2"
|
||||||
plugin-lombok = "8.0.1"
|
plugin-lombok = "8.0.1"
|
||||||
|
|||||||
+3
-6
@@ -12,18 +12,15 @@ import org.keycloak.adapters.authorization.spi.ConfigurationResolver
|
|||||||
import org.keycloak.adapters.authorization.spi.HttpRequest
|
import org.keycloak.adapters.authorization.spi.HttpRequest
|
||||||
import org.keycloak.representations.adapters.config.PolicyEnforcerConfig
|
import org.keycloak.representations.adapters.config.PolicyEnforcerConfig
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
|
||||||
|
|
||||||
|
|
||||||
class SpringPolicyEnforcerFilter(private val configResolver: ConfigurationResolver) : Filter {
|
class SpringPolicyEnforcerFilter(private val configResolver: ConfigurationResolver) : Filter {
|
||||||
private val policyEnforcer: MutableMap<PolicyEnforcerConfig, SpringPolicyEnforcer> = ConcurrentHashMap()
|
|
||||||
|
|
||||||
@Throws(IOException::class, ServletException::class)
|
@Throws(IOException::class, ServletException::class)
|
||||||
override fun doFilter(servletRequest: ServletRequest, servletResponse: ServletResponse?, filterChain: FilterChain) {
|
override fun doFilter(servletRequest: ServletRequest, servletResponse: ServletResponse?, filterChain: FilterChain) {
|
||||||
val request = servletRequest as HttpServletRequest
|
val request = servletRequest as HttpServletRequest
|
||||||
val response = servletResponse as HttpServletResponse?
|
val response = servletResponse as HttpServletResponse?
|
||||||
val httpRequest = ServletHttpRequest(request) { extractBearerToken(request) }
|
val httpRequest = ServletHttpRequest(request) { extractBearerToken(request) }
|
||||||
val policyEnforcer = getOrCreatePolicyEnforcer(httpRequest)
|
val policyEnforcer = createPolicyEnforcer(httpRequest)
|
||||||
val authzContext = policyEnforcer.enforce(httpRequest, ServletHttpResponse(response))
|
val authzContext = policyEnforcer.enforce(httpRequest, ServletHttpResponse(response))
|
||||||
request.setAttribute(AuthorizationContext::class.java.name, authzContext)
|
request.setAttribute(AuthorizationContext::class.java.name, authzContext)
|
||||||
if (authzContext.isGranted) {
|
if (authzContext.isGranted) {
|
||||||
@@ -53,8 +50,8 @@ class SpringPolicyEnforcerFilter(private val configResolver: ConfigurationResolv
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getOrCreatePolicyEnforcer(request: HttpRequest): SpringPolicyEnforcer {
|
private fun createPolicyEnforcer(request: HttpRequest): SpringPolicyEnforcer {
|
||||||
return policyEnforcer.computeIfAbsent(configResolver.resolve(request)) { createPolicyEnforcer(it) }
|
return createPolicyEnforcer(configResolver.resolve(request))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createPolicyEnforcer(enforcerConfig: PolicyEnforcerConfig): SpringPolicyEnforcer {
|
private fun createPolicyEnforcer(enforcerConfig: PolicyEnforcerConfig): SpringPolicyEnforcer {
|
||||||
|
|||||||
Reference in New Issue
Block a user