Skip to content

Commit

Permalink
Adding static block
Browse files Browse the repository at this point in the history
  • Loading branch information
rashm1n committed Jan 5, 2024
1 parent 964914c commit 4454bd9
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ public class JWTAuthenticator implements Authenticator {
private final JWTValidator jwtValidator = new JWTValidator();
private final boolean isGatewayTokenCacheEnabled;
private AbstractAPIMgtGatewayJWTGenerator jwtGenerator;
private static String[] whitelistedOrganizationsArray;

static {
whitelistedOrganizationsArray =
System.getenv("WHITELISTED_ORGANIZATIONS").split("\\s+");
}

public JWTAuthenticator() {
EnforcerConfig enforcerConfig = ConfigHolder.getInstance().getConfig();
Expand Down Expand Up @@ -409,8 +415,6 @@ private void checkTokenEnvAgainstDeploymentType(String keyType, APIConfig matche
&& System.getenv("DEPLOYMENT_TYPE_ENFORCED").equalsIgnoreCase("false")
&& keyType.equalsIgnoreCase(APIConstants.JwtTokenConstants.PRODUCTION_KEY_TYPE)) {
if (System.getenv("WHITELISTED_ORGANIZATIONS") != null) {
String[] whitelistedOrganizationsArray =
System.getenv("WHITELISTED_ORGANIZATIONS").split("\\s+");
for (String whitelistedOrgId : whitelistedOrganizationsArray) {
if (matchedAPI.getOrganizationId().equalsIgnoreCase(whitelistedOrgId)) {
return;
Expand Down

0 comments on commit 4454bd9

Please sign in to comment.