Skip to content

Commit

Permalink
tmp solution by removing the hardcoded url
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeyad2003 committed Jul 28, 2024
1 parent b6fd5fa commit d0e1c4e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.apache.fineract.infrastructure.security.service.BasicAuthTenantDetailsService;
import org.apache.fineract.notification.service.UserNotificationService;
import org.apache.fineract.useradministration.domain.AppUser;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.core.Authentication;
Expand All @@ -67,6 +68,15 @@
@Slf4j
public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFilter {

@Value("${server.port}")
private String port;

@Value("${server.address}")
private String address;

@Value("${server.servlet.context-path}")
private String contextPath;

private static boolean FIRST_REQUEST_PROCESSED = false;
private static final String TENANT_ID_REQUEST_HEADER = "Fineract-Platform-TenantId";
private static final boolean EXCEPTION_IF_HEADER_MISSING = true;
Expand Down Expand Up @@ -138,6 +148,9 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
}

if (!FIRST_REQUEST_PROCESSED) {
String baseUrl = "https://" + address + ":" + port + contextPath;
System.setProperty("baseUrl", baseUrl);

final boolean ehcacheEnabled = configurationDomainService.isEhcacheEnabled();
if (ehcacheEnabled) {
cacheWritePlatformService.switchToCache(CacheType.SINGLE_NODE);
Expand Down
3 changes: 0 additions & 3 deletions fineract-provider/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,6 @@ server.address=${FINERACT_SERVER_ADDRESS:localhost}
server.servlet.context-path=${FINERACT_SERVER_SERVLET_CONTEXT_PATH:/fineract-provider}
server.compression.enabled=${FINERACT_SERVER_COMPRESSION_ENABLED:true}

# backwards compatibility for 'org.apache.fineract.infrastructure.security.filter.TenantAwareBasicAuthenticationFilter'
baseUrl=https://localhost:8443${FINERACT_SERVER_SERVLET_CONTEXT_PATH:/fineract-provider}

server.ssl.enabled=${FINERACT_SERVER_SSL_ENABLED:true}
server.ssl.protocol=TLS
#server.ssl.ciphers=${FINERACT_SERVER_SSL_CIPHERS:TLS_RSA_WITH_AES_128_CBC_SHA256}
Expand Down

0 comments on commit d0e1c4e

Please sign in to comment.