Merge branch 'RED-9147' into 'main'
RED-9147: Added function to authenticate needed for websockets See merge request fforesight/keycloak-commons!12
This commit is contained in:
commit
24fec3b84f
@ -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));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user