2024-04-01 10:16:19 +02:00
|
|
|
package eu.eudat.service.keycloak;
|
2023-11-29 15:12:56 +01:00
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
@EnableConfigurationProperties(KeycloakResourcesProperties.class)
|
|
|
|
public class KeycloakResourcesConfiguration {
|
|
|
|
|
|
|
|
private final KeycloakResourcesProperties properties;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
public KeycloakResourcesConfiguration(KeycloakResourcesProperties properties) {
|
|
|
|
this.properties = properties;
|
|
|
|
}
|
|
|
|
|
|
|
|
public KeycloakResourcesProperties getProperties() {
|
|
|
|
return properties;
|
|
|
|
}
|
|
|
|
|
2024-04-16 12:17:58 +02:00
|
|
|
public String getTenantGroupName(String tenantCode) {
|
|
|
|
return properties.getTenantGroupsNamingStrategy()
|
|
|
|
.replace("{tenantCode}", tenantCode);
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getTenantRoleAttributeValue(String tenantCode, String key) {
|
|
|
|
return properties.getTenantAuthorities().get(key).getRoleAttributeValueStrategy()
|
|
|
|
.replace("{tenantCode}", tenantCode);
|
|
|
|
}
|
|
|
|
|
2023-11-29 15:12:56 +01:00
|
|
|
}
|