Compare commits

..

8 Commits
0.27.0 ... main

Author SHA1 Message Date
Timo Bejan
5cd85bd96b Merge branch 'RED-10106' into 'main'
Updated to latest tenant-commons

See merge request fforesight/keycloak-commons!14
2024-09-25 13:02:40 +02:00
Timo Bejan
034fea4284 Updated to latest tenant-commons 2024-09-25 14:00:54 +03:00
Maverick Studer
3ab14abbed Merge branch 'RED-9331' into 'main'
RED-9331: Explore possibilities for fair upload / analysis processing per tenant

See merge request fforesight/keycloak-commons!13
2024-07-18 14:54:37 +02:00
Maverick Studer
ef750953d6 RED-9331: Explore possibilities for fair upload / analysis processing per tenant 2024-07-18 14:54:37 +02:00
Dominique Eifländer
24fec3b84f Merge branch 'RED-9147' into 'main'
RED-9147: Added function to authenticate needed for websockets

See merge request fforesight/keycloak-commons!12
2024-05-17 16:04:41 +02:00
Dominique Eifländer
526887f3e2 RED-9147: Added function to authenticate needed for websockets 2024-05-17 15:44:22 +02:00
Maverick Studer
2a8196a69f Merge branch 'RED-8702' into 'main'
RED-8702: Explore document databases to store entityLog

See merge request fforesight/keycloak-commons!11
2024-04-11 12:11:21 +02:00
Maverick Studer
c85fa7da0a RED-8702: Explore document databases to store entityLog 2024-04-11 12:11:21 +02:00
3 changed files with 16 additions and 7 deletions

1
.gitignore vendored
View File

@ -39,3 +39,4 @@ gradle/
**/.gradle
**/build
.DS_Store

View File

@ -1,7 +1,6 @@
plugins {
`java-library`
`maven-publish`
`kotlin-dsl`
pmd
checkstyle
jacoco
@ -12,12 +11,11 @@ plugins {
val springVersion = "3.2.2";
dependencies {
api("com.knecon.fforesight:tenant-commons:0.23.0")
api("com.knecon.fforesight:tenant-commons:0.31.0")
api("org.springframework.boot:spring-boot-starter-oauth2-resource-server:${springVersion}")
api("org.springframework.boot:spring-boot-starter-security:${springVersion}")
api("org.springframework.boot:spring-boot-starter-web:${springVersion}")
api("org.springframework.boot:spring-boot-configuration-processor:${springVersion}")
api("org.projectlombok:lombok:1.18.30")
testImplementation("org.springframework.boot:spring-boot-starter-test:${springVersion}")
}
@ -81,7 +79,7 @@ tasks.named<Test>("test") {
sonarqube {
properties {
property("sonar.login", providers.gradleProperty("sonarToken").getOrNull())
providers.gradleProperty("sonarToken").getOrNull()?.let { property("sonar.login", it) }
property("sonar.host.url", "https://sonarqube.knecon.com")
}
}
@ -101,4 +99,4 @@ tasks.jacocoTestReport {
java {
withJavadocJar()
}
}

View File

@ -1,6 +1,5 @@
package com.knecon.fforesight.keycloakcommons.security;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
@ -8,7 +7,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.AuthenticationManagerResolver;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.security.oauth2.jwt.JwtDecoders;
import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter;
import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationProvider;
import org.springframework.security.oauth2.server.resource.web.BearerTokenResolver;
@ -37,6 +35,18 @@ public class TenantAuthenticationManagerResolver implements AuthenticationManage
}
public AuthenticationManager resolve(String token) {
return this.authenticationManagers.computeIfAbsent(toTenant(token), this::fromTenant);
}
private String toTenant(String token) {
return TokenUtils.toTenant(token);
}
private String toTenant(HttpServletRequest request) {
return TokenUtils.toTenant(this.resolver.resolve(request));