Search in sources :

Example 1 with KeyManagerDTO

use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.KeyManagerDTO in project carbon-apimgt by wso2.

the class KeyManagerMappingUtil method fromOpenIdConnectConfigurationToKeyManagerConfiguration.

public static KeyManagerWellKnownResponseDTO fromOpenIdConnectConfigurationToKeyManagerConfiguration(OpenIdConnectConfiguration openIdConnectConfiguration) {
    KeyManagerWellKnownResponseDTO keyManagerWellKnownResponseDTO = new KeyManagerWellKnownResponseDTO();
    if (openIdConnectConfiguration != null) {
        keyManagerWellKnownResponseDTO.setValid(true);
        KeyManagerDTO keyManagerDto = new KeyManagerDTO();
        keyManagerDto.setIssuer(openIdConnectConfiguration.getIssuer());
        keyManagerDto.setIntrospectionEndpoint(openIdConnectConfiguration.getIntrospectionEndpoint());
        keyManagerDto.setClientRegistrationEndpoint(openIdConnectConfiguration.getRegistrationEndpoint());
        keyManagerDto.setAuthorizeEndpoint(openIdConnectConfiguration.getAuthorizeEndpoint());
        keyManagerDto.setTokenEndpoint(openIdConnectConfiguration.getTokenEndpoint());
        keyManagerDto.setRevokeEndpoint(openIdConnectConfiguration.getRevokeEndpoint());
        keyManagerDto.setEnabled(true);
        keyManagerDto.setEnableTokenGeneration(true);
        keyManagerDto.setEnableMapOAuthConsumerApps(true);
        keyManagerDto.setEnableOAuthAppCreation(true);
        keyManagerDto.setEnableSelfValidationJWT(true);
        keyManagerDto.setAvailableGrantTypes(openIdConnectConfiguration.getGrantTypesSupported());
        if (StringUtils.isNotEmpty(openIdConnectConfiguration.getJwksEndpoint())) {
            KeyManagerCertificatesDTO keyManagerCertificatesDTO = new KeyManagerCertificatesDTO();
            keyManagerCertificatesDTO.setType(KeyManagerCertificatesDTO.TypeEnum.JWKS);
            keyManagerCertificatesDTO.setValue(openIdConnectConfiguration.getJwksEndpoint());
            keyManagerDto.setCertificates(keyManagerCertificatesDTO);
        }
        keyManagerWellKnownResponseDTO.setValue(keyManagerDto);
    }
    return keyManagerWellKnownResponseDTO;
}
Also used : KeyManagerCertificatesDTO(org.wso2.carbon.apimgt.rest.api.admin.v1.dto.KeyManagerCertificatesDTO) KeyManagerWellKnownResponseDTO(org.wso2.carbon.apimgt.rest.api.admin.v1.dto.KeyManagerWellKnownResponseDTO) KeyManagerDTO(org.wso2.carbon.apimgt.rest.api.admin.v1.dto.KeyManagerDTO)

Example 2 with KeyManagerDTO

use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.KeyManagerDTO in project carbon-apimgt by wso2.

the class KeyManagerMappingUtil method toKeyManagerDTO.

public static KeyManagerDTO toKeyManagerDTO(KeyManagerConfigurationDTO keyManagerConfigurationDTO) {
    KeyManagerDTO keyManagerDTO = new KeyManagerDTO();
    keyManagerDTO.setId(keyManagerConfigurationDTO.getUuid());
    keyManagerDTO.setName(keyManagerConfigurationDTO.getName());
    keyManagerDTO.setDisplayName(keyManagerConfigurationDTO.getDisplayName());
    keyManagerDTO.setDescription(keyManagerConfigurationDTO.getDescription());
    keyManagerDTO.setType(keyManagerConfigurationDTO.getType());
    keyManagerDTO.setEnabled(keyManagerConfigurationDTO.isEnabled());
    keyManagerDTO.setTokenType(KeyManagerDTO.TokenTypeEnum.valueOf(keyManagerConfigurationDTO.getTokenType()));
    keyManagerDTO.setAlias(keyManagerConfigurationDTO.getAlias());
    keyManagerDTO.setTokenType(KeyManagerDTO.TokenTypeEnum.fromValue(keyManagerConfigurationDTO.getTokenType()));
    JsonObject jsonObject = fromConfigurationMapToJson(keyManagerConfigurationDTO.getAdditionalProperties());
    JsonElement clientRegistrationElement = jsonObject.get(APIConstants.KeyManager.CLIENT_REGISTRATION_ENDPOINT);
    if (clientRegistrationElement != null) {
        keyManagerDTO.setClientRegistrationEndpoint(clientRegistrationElement.getAsString());
        jsonObject.remove(APIConstants.KeyManager.CLIENT_REGISTRATION_ENDPOINT);
    }
    JsonElement introspectionElement = jsonObject.get(APIConstants.KeyManager.INTROSPECTION_ENDPOINT);
    if (introspectionElement != null) {
        keyManagerDTO.setIntrospectionEndpoint(introspectionElement.getAsString());
        jsonObject.remove(APIConstants.KeyManager.INTROSPECTION_ENDPOINT);
    }
    JsonElement tokenEndpointElement = jsonObject.get(APIConstants.KeyManager.TOKEN_ENDPOINT);
    if (tokenEndpointElement != null) {
        keyManagerDTO.setTokenEndpoint(tokenEndpointElement.getAsString());
        jsonObject.remove(APIConstants.KeyManager.TOKEN_ENDPOINT);
    }
    JsonElement displayTokenEndpointElement = jsonObject.get(APIConstants.KeyManager.DISPLAY_TOKEN_ENDPOINT);
    if (displayTokenEndpointElement != null && !displayTokenEndpointElement.getAsString().trim().isEmpty()) {
        keyManagerDTO.setDisplayTokenEndpoint(displayTokenEndpointElement.getAsString());
        jsonObject.remove(APIConstants.KeyManager.DISPLAY_TOKEN_ENDPOINT);
    }
    JsonElement revokeEndpointElement = jsonObject.get(APIConstants.KeyManager.REVOKE_ENDPOINT);
    if (revokeEndpointElement != null) {
        keyManagerDTO.setRevokeEndpoint(revokeEndpointElement.getAsString());
        jsonObject.remove(APIConstants.KeyManager.REVOKE_ENDPOINT);
    }
    JsonElement displayRevokeEndpointElement = jsonObject.get(APIConstants.KeyManager.DISPLAY_REVOKE_ENDPOINT);
    if (displayRevokeEndpointElement != null && !displayRevokeEndpointElement.getAsString().trim().isEmpty()) {
        keyManagerDTO.setDisplayRevokeEndpoint(displayRevokeEndpointElement.getAsString());
        jsonObject.remove(APIConstants.KeyManager.DISPLAY_REVOKE_ENDPOINT);
    }
    JsonElement scopeEndpointElement = jsonObject.get(APIConstants.KeyManager.SCOPE_MANAGEMENT_ENDPOINT);
    if (scopeEndpointElement != null) {
        keyManagerDTO.setScopeManagementEndpoint(scopeEndpointElement.getAsString());
        jsonObject.remove(APIConstants.KeyManager.SCOPE_MANAGEMENT_ENDPOINT);
    }
    JsonElement grantTypesElement = jsonObject.get(APIConstants.KeyManager.AVAILABLE_GRANT_TYPE);
    if (grantTypesElement instanceof JsonArray) {
        keyManagerDTO.setAvailableGrantTypes(new Gson().fromJson(grantTypesElement, List.class));
        jsonObject.remove(APIConstants.KeyManager.AVAILABLE_GRANT_TYPE);
    }
    JsonElement issuerElement = jsonObject.get(APIConstants.KeyManager.ISSUER);
    if (issuerElement != null) {
        keyManagerDTO.setIssuer(issuerElement.getAsString());
        jsonObject.remove(APIConstants.KeyManager.ISSUER);
    }
    JsonElement wellKnownEndpointElement = jsonObject.get(APIConstants.KeyManager.WELL_KNOWN_ENDPOINT);
    if (wellKnownEndpointElement != null) {
        keyManagerDTO.setWellKnownEndpoint(wellKnownEndpointElement.getAsString());
        jsonObject.remove(APIConstants.KeyManager.WELL_KNOWN_ENDPOINT);
    }
    JsonElement certificateValueElement = jsonObject.get(APIConstants.KeyManager.CERTIFICATE_VALUE);
    JsonElement certificateTypeElement = jsonObject.get(APIConstants.KeyManager.CERTIFICATE_TYPE);
    if (certificateTypeElement != null && certificateValueElement != null) {
        KeyManagerCertificatesDTO keyManagerCertificatesDTO = new KeyManagerCertificatesDTO();
        keyManagerCertificatesDTO.setValue(certificateValueElement.getAsString());
        if (APIConstants.KeyManager.CERTIFICATE_TYPE_JWKS_ENDPOINT.equals(certificateTypeElement.getAsString())) {
            keyManagerCertificatesDTO.setType(KeyManagerCertificatesDTO.TypeEnum.JWKS);
        } else if (APIConstants.KeyManager.CERTIFICATE_TYPE_PEM_FILE.equals(certificateTypeElement.getAsString())) {
            keyManagerCertificatesDTO.setType(KeyManagerCertificatesDTO.TypeEnum.PEM);
        }
        keyManagerDTO.setCertificates(keyManagerCertificatesDTO);
        jsonObject.remove(APIConstants.KeyManager.CERTIFICATE_VALUE);
        jsonObject.remove(APIConstants.KeyManager.CERTIFICATE_TYPE);
    }
    JsonElement userInfoEndpoint = jsonObject.get(APIConstants.KeyManager.USERINFO_ENDPOINT);
    if (userInfoEndpoint != null) {
        keyManagerDTO.setUserInfoEndpoint(userInfoEndpoint.getAsString());
        jsonObject.remove(APIConstants.KeyManager.USERINFO_ENDPOINT);
    }
    JsonElement authorizeEndpoint = jsonObject.get(APIConstants.KeyManager.AUTHORIZE_ENDPOINT);
    if (authorizeEndpoint != null) {
        keyManagerDTO.setAuthorizeEndpoint(authorizeEndpoint.getAsString());
        jsonObject.remove(APIConstants.KeyManager.AUTHORIZE_ENDPOINT);
    }
    JsonElement enableOauthAppCreation = jsonObject.get(APIConstants.KeyManager.ENABLE_OAUTH_APP_CREATION);
    if (enableOauthAppCreation != null) {
        keyManagerDTO.setEnableOAuthAppCreation(enableOauthAppCreation.getAsBoolean());
        jsonObject.remove(APIConstants.KeyManager.ENABLE_OAUTH_APP_CREATION);
    }
    JsonElement enableMapOauthConsumerApps = jsonObject.get(APIConstants.KeyManager.ENABLE_MAP_OAUTH_CONSUMER_APPS);
    if (enableMapOauthConsumerApps != null) {
        keyManagerDTO.setEnableMapOAuthConsumerApps(enableMapOauthConsumerApps.getAsBoolean());
        jsonObject.remove(APIConstants.KeyManager.ENABLE_MAP_OAUTH_CONSUMER_APPS);
    }
    JsonElement enableTokenEncryption = jsonObject.get(APIConstants.KeyManager.ENABLE_TOKEN_ENCRYPTION);
    if (enableTokenEncryption != null) {
        keyManagerDTO.setEnableTokenEncryption(enableTokenEncryption.getAsBoolean());
        jsonObject.remove(APIConstants.KeyManager.ENABLE_TOKEN_ENCRYPTION);
    }
    JsonElement enableTokenHHashing = jsonObject.get(APIConstants.KeyManager.ENABLE_TOKEN_HASH);
    if (enableTokenEncryption != null) {
        keyManagerDTO.setEnableTokenHashing(enableTokenHHashing.getAsBoolean());
        jsonObject.remove(APIConstants.KeyManager.ENABLE_TOKEN_HASH);
    }
    JsonElement enableTokenGeneration = jsonObject.get(APIConstants.KeyManager.ENABLE_TOKEN_GENERATION);
    if (enableTokenGeneration != null) {
        keyManagerDTO.setEnableTokenGeneration(enableTokenGeneration.getAsBoolean());
        jsonObject.remove(APIConstants.KeyManager.ENABLE_TOKEN_GENERATION);
    }
    JsonElement selfValidateJWTElement = jsonObject.get(APIConstants.KeyManager.SELF_VALIDATE_JWT);
    JsonElement validationValueElement = jsonObject.get(APIConstants.KeyManager.TOKEN_FORMAT_STRING);
    if (validationValueElement instanceof JsonPrimitive) {
        keyManagerDTO.setTokenValidation(Arrays.asList(new Gson().fromJson(validationValueElement.getAsString(), TokenValidationDTO[].class)));
        jsonObject.remove(APIConstants.KeyManager.TOKEN_FORMAT_STRING);
    }
    if (selfValidateJWTElement != null) {
        keyManagerDTO.setEnableSelfValidationJWT(selfValidateJWTElement.getAsBoolean());
    }
    JsonElement claimMappingElement = jsonObject.get(APIConstants.KeyManager.CLAIM_MAPPING);
    if (claimMappingElement != null) {
        keyManagerDTO.setClaimMapping(Arrays.asList(new Gson().fromJson(claimMappingElement, ClaimMappingEntryDTO[].class)));
        jsonObject.remove(APIConstants.KeyManager.CLAIM_MAPPING);
    }
    JsonElement scopeClaimKey = jsonObject.get(APIConstants.KeyManager.SCOPES_CLAIM);
    if (scopeClaimKey != null) {
        keyManagerDTO.setScopesClaim(scopeClaimKey.getAsString());
        jsonObject.remove(APIConstants.KeyManager.SCOPES_CLAIM);
    }
    JsonElement consumerKeyClaim = jsonObject.get(APIConstants.KeyManager.CONSUMER_KEY_CLAIM);
    if (scopeClaimKey != null) {
        keyManagerDTO.setConsumerKeyClaim(consumerKeyClaim.getAsString());
        jsonObject.remove(APIConstants.KeyManager.CONSUMER_KEY_CLAIM);
    }
    keyManagerDTO.setAdditionalProperties(new Gson().fromJson(jsonObject, Map.class));
    return keyManagerDTO;
}
Also used : JsonArray(com.google.gson.JsonArray) KeyManagerCertificatesDTO(org.wso2.carbon.apimgt.rest.api.admin.v1.dto.KeyManagerCertificatesDTO) JsonPrimitive(com.google.gson.JsonPrimitive) JsonElement(com.google.gson.JsonElement) TokenValidationDTO(org.wso2.carbon.apimgt.rest.api.admin.v1.dto.TokenValidationDTO) JsonObject(com.google.gson.JsonObject) Gson(com.google.gson.Gson) KeyManagerDTO(org.wso2.carbon.apimgt.rest.api.admin.v1.dto.KeyManagerDTO) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) ClaimMappingEntryDTO(org.wso2.carbon.apimgt.rest.api.admin.v1.dto.ClaimMappingEntryDTO)

Example 3 with KeyManagerDTO

use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.KeyManagerDTO in project carbon-apimgt by wso2.

the class KeyManagersApiServiceImpl method keyManagersKeyManagerIdPut.

public Response keyManagersKeyManagerIdPut(String keyManagerId, KeyManagerDTO body, MessageContext messageContext) throws APIManagementException {
    String organization = RestApiUtil.getOrganization(messageContext);
    APIAdmin apiAdmin = new APIAdminImpl();
    try {
        KeyManagerConfigurationDTO keyManagerConfigurationDTO = KeyManagerMappingUtil.toKeyManagerConfigurationDTO(organization, body);
        keyManagerConfigurationDTO.setUuid(keyManagerId);
        KeyManagerConfigurationDTO oldKeyManagerConfigurationDTO = apiAdmin.getKeyManagerConfigurationById(organization, keyManagerId);
        if (oldKeyManagerConfigurationDTO == null) {
            throw new APIManagementException("Requested KeyManager not found", ExceptionCodes.KEY_MANAGER_NOT_FOUND);
        } else {
            if (!oldKeyManagerConfigurationDTO.getName().equals(keyManagerConfigurationDTO.getName())) {
                RestApiUtil.handleBadRequest("Key Manager name couldn't able to change", log);
            }
            KeyManagerConfigurationDTO retrievedKeyManagerConfigurationDTO = apiAdmin.updateKeyManagerConfiguration(keyManagerConfigurationDTO);
            APIUtil.logAuditMessage(APIConstants.AuditLogConstants.KEY_MANAGER, new Gson().toJson(keyManagerConfigurationDTO), APIConstants.AuditLogConstants.UPDATED, RestApiCommonUtil.getLoggedInUsername());
            return Response.ok(KeyManagerMappingUtil.toKeyManagerDTO(retrievedKeyManagerConfigurationDTO)).build();
        }
    } catch (APIManagementException e) {
        String error = "Error while Retrieving Key Manager configuration for " + keyManagerId + " in organization " + organization;
        throw new APIManagementException(error, e, ExceptionCodes.INTERNAL_ERROR);
    }
}
Also used : KeyManagerConfigurationDTO(org.wso2.carbon.apimgt.api.dto.KeyManagerConfigurationDTO) APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException) APIAdmin(org.wso2.carbon.apimgt.api.APIAdmin) Gson(com.google.gson.Gson) APIAdminImpl(org.wso2.carbon.apimgt.impl.APIAdminImpl)

Example 4 with KeyManagerDTO

use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.KeyManagerDTO in project carbon-apimgt by wso2.

the class KeyManagersApiServiceImpl method keyManagersKeyManagerIdGet.

public Response keyManagersKeyManagerIdGet(String keyManagerId, MessageContext messageContext) throws APIManagementException {
    String organization = RestApiUtil.getOrganization(messageContext);
    APIAdmin apiAdmin = new APIAdminImpl();
    KeyManagerConfigurationDTO keyManagerConfigurationDTO = apiAdmin.getKeyManagerConfigurationById(organization, keyManagerId);
    if (keyManagerConfigurationDTO != null) {
        KeyManagerDTO keyManagerDTO = KeyManagerMappingUtil.toKeyManagerDTO(keyManagerConfigurationDTO);
        return Response.ok(keyManagerDTO).build();
    }
    throw new APIManagementException("Requested KeyManager not found", ExceptionCodes.KEY_MANAGER_NOT_FOUND);
}
Also used : KeyManagerConfigurationDTO(org.wso2.carbon.apimgt.api.dto.KeyManagerConfigurationDTO) APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException) APIAdmin(org.wso2.carbon.apimgt.api.APIAdmin) KeyManagerDTO(org.wso2.carbon.apimgt.rest.api.admin.v1.dto.KeyManagerDTO) APIAdminImpl(org.wso2.carbon.apimgt.impl.APIAdminImpl)

Example 5 with KeyManagerDTO

use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.KeyManagerDTO in project carbon-apimgt by wso2.

the class APIProviderImplTest method init.

@Before
public void init() throws Exception {
    System.setProperty("carbon.home", APIProviderImplTest.class.getResource("/").getFile());
    PowerMockito.mockStatic(ApiMgtDAO.class);
    PowerMockito.mockStatic(GatewayArtifactsMgtDAO.class);
    PowerMockito.mockStatic(ScopesDAO.class);
    PowerMockito.mockStatic(PrivilegedCarbonContext.class);
    PowerMockito.mockStatic(RegistryUtils.class);
    PowerMockito.mockStatic(GovernanceUtils.class);
    PowerMockito.mockStatic(WorkflowExecutorFactory.class);
    PowerMockito.mockStatic(LifecycleBeanPopulator.class);
    PowerMockito.mockStatic(KeyManagerHolder.class);
    PowerMockito.mockStatic(Caching.class);
    PowerMockito.mockStatic(PaginationContext.class);
    PowerMockito.mockStatic(APIUtil.class);
    PowerMockito.mockStatic(APIGatewayManager.class);
    PowerMockito.mockStatic(CertificateManagerImpl.class);
    PowerMockito.mockStatic(RegistryPersistenceUtil.class);
    apimgtDAO = Mockito.mock(ApiMgtDAO.class);
    gatewayArtifactsMgtDAO = Mockito.mock(GatewayArtifactsMgtDAO.class);
    scopesDAO = Mockito.mock(ScopesDAO.class);
    keyManager = Mockito.mock(KeyManager.class);
    apiPersistenceInstance = Mockito.mock(APIPersistence.class);
    certificateManager = Mockito.mock(CertificateManagerImpl.class);
    Mockito.when(keyManager.getResourceByApiId(Mockito.anyString())).thenReturn(null);
    Mockito.when(keyManager.registerNewResource(Mockito.any(API.class), Mockito.any(Map.class))).thenReturn(true);
    KeyManagerDto keyManagerDto = new KeyManagerDto();
    keyManagerDto.setName("default");
    keyManagerDto.setKeyManager(keyManager);
    keyManagerDto.setIssuer("https://localhost");
    Map<String, KeyManagerDto> tenantKeyManagerDtoMap = new HashMap<>();
    tenantKeyManagerDtoMap.put("default", keyManagerDto);
    PowerMockito.when(KeyManagerHolder.getTenantKeyManagers("carbon.super")).thenReturn(tenantKeyManagerDtoMap);
    PowerMockito.when(CertificateManagerImpl.getInstance()).thenReturn(certificateManager);
    PowerMockito.when(APIUtil.isAPIManagementEnabled()).thenReturn(false);
    PowerMockito.when(APIUtil.replaceEmailDomainBack(Mockito.anyString())).thenReturn("admin");
    Mockito.when(APIUtil.replaceEmailDomain(Mockito.anyString())).thenReturn("admin");
    PrivilegedCarbonContext prcontext = Mockito.mock(PrivilegedCarbonContext.class);
    PowerMockito.when(PrivilegedCarbonContext.getThreadLocalCarbonContext()).thenReturn(prcontext);
    PowerMockito.doNothing().when(prcontext).setUsername(Mockito.anyString());
    PowerMockito.doNothing().when(prcontext).setTenantDomain(Mockito.anyString(), Mockito.anyBoolean());
    artifactManager = Mockito.mock(GenericArtifactManager.class);
    registry = Mockito.mock(Registry.class);
    PowerMockito.when(APIUtil.getArtifactManager(any(Registry.class), Mockito.anyString())).thenReturn(artifactManager);
    artifact = Mockito.mock(GenericArtifact.class);
    gatewayManager = Mockito.mock(APIGatewayManager.class);
    Mockito.when(APIGatewayManager.getInstance()).thenReturn(gatewayManager);
    TestUtils.mockRegistryAndUserRealm(-1234);
    TestUtils.mockAPICacheClearence();
    TestUtils.mockAPIMConfiguration();
    mockDocumentationCreation();
    config = Mockito.mock(APIManagerConfiguration.class);
    APIManagerConfigurationService apiManagerConfigurationService = new APIManagerConfigurationServiceImpl(config);
    ServiceReferenceHolder.getInstance().setAPIManagerConfigurationService(apiManagerConfigurationService);
    APIManagerConfiguration config = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService().getAPIManagerConfiguration();
    GatewayArtifactSynchronizerProperties synchronizerProperties = new GatewayArtifactSynchronizerProperties();
    Mockito.when(config.getGatewayArtifactSynchronizerProperties()).thenReturn(synchronizerProperties);
    Mockito.when(config.getApiRecommendationEnvironment()).thenReturn(null);
    PowerMockito.when(APIUtil.replaceSystemProperty(Mockito.anyString())).thenAnswer((Answer<String>) invocation -> {
        Object[] args = invocation.getArguments();
        return (String) args[0];
    });
    TestUtils.initConfigurationContextService(true);
    superTenantDomain = "carbon.super";
}
Also used : RegistryAuthorizationManager(org.wso2.carbon.registry.core.jdbc.realm.RegistryAuthorizationManager) StringUtils(org.apache.commons.lang.StringUtils) ApiTypeWrapper(org.wso2.carbon.apimgt.api.model.ApiTypeWrapper) APIPersistenceException(org.wso2.carbon.apimgt.persistence.exceptions.APIPersistenceException) PaginationContext(org.wso2.carbon.registry.core.pagination.PaginationContext) LifecycleBean(org.wso2.carbon.governance.custom.lifecycles.checklist.beans.LifecycleBean) QuotaPolicy(org.wso2.carbon.apimgt.api.model.policy.QuotaPolicy) RealmService(org.wso2.carbon.user.core.service.RealmService) ResourceImpl(org.wso2.carbon.registry.core.ResourceImpl) ImportExportAPI(org.wso2.carbon.apimgt.impl.importexport.ImportExportAPI) Map(java.util.Map) XMLStreamException(javax.xml.stream.XMLStreamException) ApplicationPolicy(org.wso2.carbon.apimgt.api.model.policy.ApplicationPolicy) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) APIPolicy(org.wso2.carbon.apimgt.api.model.policy.APIPolicy) AuthorizationManager(org.wso2.carbon.user.api.AuthorizationManager) DocumentationType(org.wso2.carbon.apimgt.api.model.DocumentationType) GatewayArtifactSynchronizerProperties(org.wso2.carbon.apimgt.impl.dto.GatewayArtifactSynchronizerProperties) ContentType(org.apache.http.entity.ContentType) Set(java.util.Set) WorkflowConstants(org.wso2.carbon.apimgt.impl.workflow.WorkflowConstants) HTTPVerbCondition(org.wso2.carbon.apimgt.api.model.policy.HTTPVerbCondition) RegistryPersistenceUtil(org.wso2.carbon.apimgt.persistence.utils.RegistryPersistenceUtil) UserStoreManager(org.wso2.carbon.user.core.UserStoreManager) Matchers.any(org.mockito.Matchers.any) IOUtils(org.apache.commons.io.IOUtils) SubscriptionPolicy(org.wso2.carbon.apimgt.api.model.policy.SubscriptionPolicy) APIImportExportException(org.wso2.carbon.apimgt.impl.importexport.APIImportExportException) SubscribedAPI(org.wso2.carbon.apimgt.api.model.SubscribedAPI) GraphQLSchemaDefinition(org.wso2.carbon.apimgt.impl.definitions.GraphQLSchemaDefinition) MultitenantUtils(org.wso2.carbon.utils.multitenancy.MultitenantUtils) Assert.assertFalse(org.junit.Assert.assertFalse) PublisherAPIProduct(org.wso2.carbon.apimgt.persistence.dto.PublisherAPIProduct) QName(javax.xml.namespace.QName) CarbonConstants(org.wso2.carbon.CarbonConstants) APIIdentifier(org.wso2.carbon.apimgt.api.model.APIIdentifier) RegistryService(org.wso2.carbon.registry.core.service.RegistryService) APIStore(org.wso2.carbon.apimgt.api.model.APIStore) BlockConditionNotFoundException(org.wso2.carbon.apimgt.api.BlockConditionNotFoundException) APIStateChangeSimpleWorkflowExecutor(org.wso2.carbon.apimgt.impl.workflow.APIStateChangeSimpleWorkflowExecutor) FaultGatewaysException(org.wso2.carbon.apimgt.api.FaultGatewaysException) UserRealm(org.wso2.carbon.user.api.UserRealm) GovernanceArtifact(org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifact) RunWith(org.junit.runner.RunWith) GlobalPolicy(org.wso2.carbon.apimgt.api.model.policy.GlobalPolicy) Association(org.wso2.carbon.registry.core.Association) SuppressStaticInitializationFor(org.powermock.core.classloader.annotations.SuppressStaticInitializationFor) ArrayList(java.util.ArrayList) DocumentationContent(org.wso2.carbon.apimgt.api.model.DocumentationContent) Answer(org.mockito.stubbing.Answer) InvocationOnMock(org.mockito.invocation.InvocationOnMock) RegistryConstants(org.wso2.carbon.registry.core.RegistryConstants) WorkflowProperties(org.wso2.carbon.apimgt.impl.dto.WorkflowProperties) Resource(org.wso2.carbon.registry.core.Resource) APIStateChangeResponse(org.wso2.carbon.apimgt.api.model.APIStateChangeResponse) Collection(org.wso2.carbon.registry.core.Collection) PowerMockito(org.powermock.api.mockito.PowerMockito) Before(org.junit.Before) URITemplate(org.wso2.carbon.apimgt.api.model.URITemplate) DuplicateAPIException(org.wso2.carbon.apimgt.api.model.DuplicateAPIException) Condition(org.wso2.carbon.apimgt.api.model.policy.Condition) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) IOException(java.io.IOException) APIMgtResourceAlreadyExistsException(org.wso2.carbon.apimgt.api.APIMgtResourceAlreadyExistsException) ScopesDAO(org.wso2.carbon.apimgt.impl.dao.ScopesDAO) Field(java.lang.reflect.Field) APIProduct(org.wso2.carbon.apimgt.api.model.APIProduct) APIRevision(org.wso2.carbon.apimgt.api.model.APIRevision) ApiMgtDAO(org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO) File(java.io.File) Assert.assertNull(org.junit.Assert.assertNull) TreeMap(java.util.TreeMap) Subscriber(org.wso2.carbon.apimgt.api.model.Subscriber) APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException) KeyManagerHolder(org.wso2.carbon.apimgt.impl.factory.KeyManagerHolder) KeyManagerDto(org.wso2.carbon.apimgt.impl.dto.KeyManagerDto) Assert(org.junit.Assert) Assert.assertEquals(org.junit.Assert.assertEquals) GenericArtifactManager(org.wso2.carbon.governance.api.generic.GenericArtifactManager) RegistryContext(org.wso2.carbon.registry.core.config.RegistryContext) ArtifactSynchronizerException(org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.exception.ArtifactSynchronizerException) KeyManager(org.wso2.carbon.apimgt.api.model.KeyManager) APIProductMapper(org.wso2.carbon.apimgt.persistence.mapper.APIProductMapper) RegistryUtils(org.wso2.carbon.registry.core.utils.RegistryUtils) XMLInputFactory(javax.xml.stream.XMLInputFactory) PolicyConstants(org.wso2.carbon.apimgt.api.model.policy.PolicyConstants) APIPersistence(org.wso2.carbon.apimgt.persistence.APIPersistence) Pipeline(org.wso2.carbon.apimgt.api.model.policy.Pipeline) BlockConditionsDTO(org.wso2.carbon.apimgt.api.model.BlockConditionsDTO) XMLStreamReader(javax.xml.stream.XMLStreamReader) UserRegistry(org.wso2.carbon.registry.core.session.UserRegistry) GovernanceUtils(org.wso2.carbon.governance.api.util.GovernanceUtils) NotifierConstants(org.wso2.carbon.apimgt.impl.notification.NotifierConstants) NotificationExecutor(org.wso2.carbon.apimgt.impl.notification.NotificationExecutor) APIUtil(org.wso2.carbon.apimgt.impl.utils.APIUtil) UUID(java.util.UUID) DocumentSourceType(org.wso2.carbon.apimgt.api.model.Documentation.DocumentSourceType) WorkflowException(org.wso2.carbon.apimgt.impl.workflow.WorkflowException) List(java.util.List) JSONObject(org.json.simple.JSONObject) DocumentVisibility(org.wso2.carbon.apimgt.api.model.Documentation.DocumentVisibility) Modifier(java.lang.reflect.Modifier) ResourceFile(org.wso2.carbon.apimgt.api.model.ResourceFile) TenantManager(org.wso2.carbon.user.core.tenant.TenantManager) PublisherAPI(org.wso2.carbon.apimgt.persistence.dto.PublisherAPI) SortedMap(java.util.SortedMap) AssertNotNull(org.apache.synapse.unittest.testcase.data.classes.AssertNotNull) Provider(org.wso2.carbon.apimgt.api.model.Provider) Matchers(org.mockito.Matchers) UserStoreException(org.wso2.carbon.user.api.UserStoreException) PrivilegedCarbonContext(org.wso2.carbon.context.PrivilegedCarbonContext) HashMap(java.util.HashMap) HashSet(java.util.HashSet) APIProductIdentifier(org.wso2.carbon.apimgt.api.model.APIProductIdentifier) Property(org.wso2.carbon.governance.custom.lifecycles.checklist.util.Property) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) RequestCountLimit(org.wso2.carbon.apimgt.api.model.policy.RequestCountLimit) PowerMockRunner(org.powermock.modules.junit4.PowerMockRunner) API(org.wso2.carbon.apimgt.api.model.API) ServiceReferenceHolder(org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder) JavaUtils(org.apache.axis2.util.JavaUtils) NotificationDTO(org.wso2.carbon.apimgt.impl.notification.NotificationDTO) DEFAULT_DIALECT_URI(org.wso2.carbon.apimgt.impl.token.ClaimsRetriever.DEFAULT_DIALECT_URI) OMElement(org.apache.axiom.om.OMElement) Tier(org.wso2.carbon.apimgt.api.model.Tier) UserApplicationAPIUsage(org.wso2.carbon.apimgt.api.dto.UserApplicationAPIUsage) GovernanceException(org.wso2.carbon.governance.api.exception.GovernanceException) APIPublisher(org.wso2.carbon.apimgt.api.model.APIPublisher) WorkflowExecutorFactory(org.wso2.carbon.apimgt.impl.workflow.WorkflowExecutorFactory) Documentation(org.wso2.carbon.apimgt.api.model.Documentation) Assert.assertNotNull(org.junit.Assert.assertNotNull) CertificateManagerImpl(org.wso2.carbon.apimgt.impl.certificatemgt.CertificateManagerImpl) Caching(javax.cache.Caching) WorkflowExecutor(org.wso2.carbon.apimgt.impl.workflow.WorkflowExecutor) GatewayArtifactsMgtDAO(org.wso2.carbon.apimgt.impl.dao.GatewayArtifactsMgtDAO) GenericArtifact(org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact) ArtifactSaver(org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.ArtifactSaver) WorkflowDTO(org.wso2.carbon.apimgt.impl.dto.WorkflowDTO) Mockito(org.mockito.Mockito) OMException(org.apache.axiom.om.OMException) Ignore(org.junit.Ignore) Registry(org.wso2.carbon.registry.core.Registry) CheckListItem(org.wso2.carbon.governance.custom.lifecycles.checklist.util.CheckListItem) StAXOMBuilder(org.apache.axiom.om.impl.builder.StAXOMBuilder) WorkflowStatus(org.wso2.carbon.apimgt.impl.workflow.WorkflowStatus) OASParserUtil(org.wso2.carbon.apimgt.impl.definitions.OASParserUtil) CORSConfiguration(org.wso2.carbon.apimgt.api.model.CORSConfiguration) Organization(org.wso2.carbon.apimgt.persistence.dto.Organization) LifecycleBeanPopulator(org.wso2.carbon.governance.custom.lifecycles.checklist.util.LifecycleBeanPopulator) InputStream(java.io.InputStream) GenericArtifact(org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact) GenericArtifactManager(org.wso2.carbon.governance.api.generic.GenericArtifactManager) HashMap(java.util.HashMap) GatewayArtifactsMgtDAO(org.wso2.carbon.apimgt.impl.dao.GatewayArtifactsMgtDAO) GatewayArtifactSynchronizerProperties(org.wso2.carbon.apimgt.impl.dto.GatewayArtifactSynchronizerProperties) ScopesDAO(org.wso2.carbon.apimgt.impl.dao.ScopesDAO) ApiMgtDAO(org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO) KeyManagerDto(org.wso2.carbon.apimgt.impl.dto.KeyManagerDto) PrivilegedCarbonContext(org.wso2.carbon.context.PrivilegedCarbonContext) UserRegistry(org.wso2.carbon.registry.core.session.UserRegistry) Registry(org.wso2.carbon.registry.core.Registry) ImportExportAPI(org.wso2.carbon.apimgt.impl.importexport.ImportExportAPI) SubscribedAPI(org.wso2.carbon.apimgt.api.model.SubscribedAPI) PublisherAPI(org.wso2.carbon.apimgt.persistence.dto.PublisherAPI) API(org.wso2.carbon.apimgt.api.model.API) KeyManager(org.wso2.carbon.apimgt.api.model.KeyManager) CertificateManagerImpl(org.wso2.carbon.apimgt.impl.certificatemgt.CertificateManagerImpl) Map(java.util.Map) TreeMap(java.util.TreeMap) SortedMap(java.util.SortedMap) HashMap(java.util.HashMap) APIPersistence(org.wso2.carbon.apimgt.persistence.APIPersistence) Before(org.junit.Before)

Aggregations

KeyManagerDto (org.wso2.carbon.apimgt.impl.dto.KeyManagerDto)16 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)15 HashMap (java.util.HashMap)13 Map (java.util.Map)13 KeyManager (org.wso2.carbon.apimgt.api.model.KeyManager)13 TreeMap (java.util.TreeMap)10 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)9 KeyManagerConfigurationDTO (org.wso2.carbon.apimgt.api.dto.KeyManagerConfigurationDTO)5 Gson (com.google.gson.Gson)4 APIAdmin (org.wso2.carbon.apimgt.api.APIAdmin)4 APIAdminImpl (org.wso2.carbon.apimgt.impl.APIAdminImpl)4 JsonObject (com.google.gson.JsonObject)3 ArrayList (java.util.ArrayList)3 APIIdentifier (org.wso2.carbon.apimgt.api.model.APIIdentifier)3 Scope (org.wso2.carbon.apimgt.api.model.Scope)3 URITemplate (org.wso2.carbon.apimgt.api.model.URITemplate)3 KeyManagerDTO (org.wso2.carbon.apimgt.rest.api.admin.v1.dto.KeyManagerDTO)3 JsonArray (com.google.gson.JsonArray)2 HashSet (java.util.HashSet)2 List (java.util.List)2