Skip to content

Commit

Permalink
resolved comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DDH13 committed Apr 24, 2024
1 parent f5e9185 commit 290c65f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion adapter/internal/operator/synchronizer/grpc_api.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,21 @@
import org.wso2.apk.enforcer.commons.Filter;
import org.wso2.apk.enforcer.commons.dto.ClaimValueDTO;
import org.wso2.apk.enforcer.commons.dto.JWTConfigurationDto;
import org.wso2.apk.enforcer.commons.model.*;
import org.wso2.apk.enforcer.commons.model.APIConfig;
import org.wso2.apk.enforcer.commons.model.ResourceConfig;
import org.wso2.apk.enforcer.commons.model.EndpointSecurity;
import org.wso2.apk.enforcer.commons.model.RequestContext;
import org.wso2.apk.enforcer.commons.model.EndpointCluster;
import org.wso2.apk.enforcer.config.ConfigHolder;
import org.wso2.apk.enforcer.config.EnforcerConfig;
import org.wso2.apk.enforcer.constants.APIConstants;
import org.wso2.apk.enforcer.constants.HttpConstants;
import org.wso2.apk.enforcer.cors.CorsFilter;
import org.wso2.apk.enforcer.discovery.api.*;
import org.wso2.apk.enforcer.discovery.api.Api;
import org.wso2.apk.enforcer.discovery.api.Resource;
import org.wso2.apk.enforcer.discovery.api.Operation;
import org.wso2.apk.enforcer.discovery.api.BackendJWTTokenInfo;
import org.wso2.apk.enforcer.discovery.api.Claim;
import org.wso2.apk.enforcer.security.AuthFilter;
import org.wso2.apk.enforcer.security.mtls.MtlsUtils;
import org.wso2.apk.enforcer.server.swagger.APIDefinitionUtils;
Expand Down Expand Up @@ -94,24 +101,11 @@ public String init(Api api) {
}



SchemaParser schemaParser = new SchemaParser();

byte[] apiDefinition = api.getApiDefinitionFile().toByteArray();
TypeDefinitionRegistry registry;

//TODO fix this
// try {
// String scheme = APIDefinitionUtils.ReadGzip(apiDefinition);
// registry = schemaParser.parse(scheme);
// } catch (IOException e) {
// logger.error("Error while parsing the GRPC schema definition of the API: " + name, e);
// throw new RuntimeException(e);
// }
// GraphQLSchema schema = UnExecutableSchemaGenerator.makeUnExecutableSchema(registry);

// GraphQLSchemaDTO graphQLSchemaDTO = new GraphQLSchemaDTO(schema, registry,
// GraphQLPayloadUtils.parseComplexityDTO(api.getGraphqlComplexityInfoList()));

String apiLifeCycleState = api.getApiLifeCycleState();
this.apiConfig = new APIConfig.Builder(name).uuid(api.getId()).vhost(vhost).basePath(basePath).version(version)
Expand All @@ -120,9 +114,8 @@ public String init(Api api) {
.disableScopes(api.getDisableScopes()).trustStore(trustStore).organizationId(api.getOrganizationId())
.mutualSSL(mutualSSL)
.applicationSecurity(applicationSecurity).jwtConfigurationDto(jwtConfigurationDto)
// .apiDefinition(apiDefinition).environment(api.getEnvironment())
.apiDefinition(apiDefinition).environment(api.getEnvironment())
.environment(api.getEnvironment())
// .subscriptionValidation(api.getSubscriptionValidation()).graphQLSchemaDTO(graphQLSchemaDTO).build();
.subscriptionValidation(api.getSubscriptionValidation()).build();
initFilters();
logger.info("APIConfig: " + this.apiConfig);
Expand Down Expand Up @@ -212,10 +205,6 @@ private void initFilters() {
authFilter.init(apiConfig, null);
this.filters.add(authFilter);

// GraphQLQueryAnalysisFilter queryAnalysisFilter = new GraphQLQueryAnalysisFilter();
// queryAnalysisFilter.init(apiConfig, null);
// this.filters.add(queryAnalysisFilter);

// CORS filter is added as the first filter, and it is not customizable.
CorsFilter corsFilter = new CorsFilter();
this.filters.add(0, corsFilter);
Expand Down
2 changes: 1 addition & 1 deletion test/integration/integration/tests/grpc-api.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down

0 comments on commit 290c65f

Please sign in to comment.