mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
making required changes
This commit is contained in:
parent
1c7d8296e7
commit
1e6a769130
@ -17,7 +17,8 @@
|
||||
~ under the License.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<parent>
|
||||
<artifactId>apimgt-extensions</artifactId>
|
||||
@ -108,10 +109,10 @@
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.apimgt.integration.client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.apimgt.integration.client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database.wso2</groupId>
|
||||
<artifactId>h2-database-engine</artifactId>
|
||||
@ -160,25 +161,25 @@
|
||||
org.wso2.carbon.apimgt.annotations.*,
|
||||
org.wso2.carbon.governance.lcm.util.*,
|
||||
org.wso2.carbon.registry.core.*,
|
||||
io.swagger.annotations,
|
||||
javax.net.ssl,
|
||||
org.scannotation,
|
||||
org.scannotation.archiveiterator,
|
||||
org.w3c.dom,
|
||||
org.wso2.carbon.apimgt.integration.client.*,
|
||||
org.wso2.carbon.context,
|
||||
org.wso2.carbon.core.util,
|
||||
org.wso2.carbon.user.api,
|
||||
org.wso2.carbon.user.core.*,
|
||||
org.wso2.carbon.utils.multitenancy,
|
||||
org.wso2.carbon.apimgt.integration.generated.client.publisher.api,
|
||||
org.wso2.carbon.apimgt.integration.generated.client.publisher.model
|
||||
io.swagger.annotations,
|
||||
javax.net.ssl,
|
||||
org.scannotation,
|
||||
org.scannotation.archiveiterator,
|
||||
org.w3c.dom,
|
||||
org.wso2.carbon.apimgt.integration.client.*,
|
||||
org.wso2.carbon.context,
|
||||
org.wso2.carbon.core.util,
|
||||
org.wso2.carbon.user.api,
|
||||
org.wso2.carbon.user.core.*,
|
||||
org.wso2.carbon.utils.multitenancy,
|
||||
org.wso2.carbon.apimgt.integration.generated.client.publisher.api,
|
||||
org.wso2.carbon.apimgt.integration.generated.client.publisher.model
|
||||
</Import-Package>
|
||||
<Embed-Dependency>
|
||||
javax.ws.rs-api,
|
||||
scribe;scope=compile|runtime;inline=false;
|
||||
</Embed-Dependency>
|
||||
<DynamicImport-Package>*</DynamicImport-Package>
|
||||
<DynamicImport-Package>*</DynamicImport-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
@ -210,5 +211,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@ -42,7 +42,7 @@ APIPublisherServiceTest extends BaseAPIPublisherTest {
|
||||
@BeforeTest
|
||||
public void initialConfigs() throws Exception {
|
||||
setApiConfigs(apiConfig);
|
||||
initialise0OAuthApplication();
|
||||
initializeOAuthApplication();
|
||||
}
|
||||
|
||||
@Test(description = "Publishes an API | will fail if there are any exceptions")
|
||||
@ -66,10 +66,10 @@ APIPublisherServiceTest extends BaseAPIPublisherTest {
|
||||
Map<String, ApiScope> apiScopes = new HashMap<>();
|
||||
Set<ApiScope> scopes = new HashSet<>(apiScopes.values());
|
||||
apiConfig.setScopes(scopes);
|
||||
setAPIUrITemplates(apiConfig);
|
||||
setAPIURITemplates(apiConfig);
|
||||
}
|
||||
|
||||
private void setAPIUrITemplates(APIConfig apiConfig) {
|
||||
private void setAPIURITemplates(APIConfig apiConfig) {
|
||||
Set<ApiUriTemplate> uriTemplates = new LinkedHashSet<>();
|
||||
ApiUriTemplate template = new ApiUriTemplate();
|
||||
template.setAuthType("Application & Application User");
|
||||
@ -86,7 +86,7 @@ APIPublisherServiceTest extends BaseAPIPublisherTest {
|
||||
apiConfig.setUriTemplates(uriTemplates);
|
||||
}
|
||||
|
||||
private void initialise0OAuthApplication() throws NoSuchFieldException, IllegalAccessException {
|
||||
private void initializeOAuthApplication() throws NoSuchFieldException, IllegalAccessException {
|
||||
OAuthApplication oAuthApplication = new OAuthApplication();
|
||||
oAuthApplication.setClientName("admin_api_integration_client");
|
||||
oAuthApplication.setIsSaasApplication("true");
|
||||
|
||||
@ -61,7 +61,7 @@ public abstract class BaseAPIPublisherTest {
|
||||
private static final Log log = LogFactory.getLog(BaseAPIPublisherTest.class);
|
||||
|
||||
@BeforeSuite
|
||||
public void initialise() throws Exception {
|
||||
public void initialize() throws Exception {
|
||||
this.initializeCarbonContext();
|
||||
this.initServices();
|
||||
}
|
||||
@ -73,13 +73,16 @@ public abstract class BaseAPIPublisherTest {
|
||||
File carbonHome = new File(resourceUrl.getFile());
|
||||
System.setProperty("carbon.home", carbonHome.getAbsolutePath());
|
||||
}
|
||||
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
|
||||
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(MultitenantConstants.
|
||||
SUPER_TENANT_DOMAIN_NAME);
|
||||
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MultitenantConstants.SUPER_TENANT_ID);
|
||||
}
|
||||
|
||||
private void initServices() throws NoSuchFieldException, IllegalAccessException, JWTClientException, UserStoreException, RegistryException {
|
||||
private void initServices() throws NoSuchFieldException, IllegalAccessException,
|
||||
JWTClientException, UserStoreException, RegistryException {
|
||||
|
||||
IntegrationClientService integrationClientService = Mockito.mock(IntegrationClientServiceImpl.class, Mockito.CALLS_REAL_METHODS);
|
||||
IntegrationClientService integrationClientService = Mockito.mock(IntegrationClientServiceImpl.class,
|
||||
Mockito.CALLS_REAL_METHODS);
|
||||
APIPublisherDataHolder.getInstance().setIntegrationClientService(integrationClientService);
|
||||
PublisherClient publisherClient = Mockito.mock(PublisherClient.class, Mockito.CALLS_REAL_METHODS);
|
||||
doReturn(publisherClient).when(integrationClientService).getPublisherClient();
|
||||
@ -95,7 +98,8 @@ public abstract class BaseAPIPublisherTest {
|
||||
"apim:subscription_view apim:subscription_block";
|
||||
accessTokenInfo.setScopes(REQUIRED_SCOPE);
|
||||
|
||||
JWTClientManagerService jwtClientManagerService = Mockito.mock(JWTClientManagerServiceImpl.class, Mockito.CALLS_REAL_METHODS);
|
||||
JWTClientManagerService jwtClientManagerService = Mockito.mock(JWTClientManagerServiceImpl.class,
|
||||
Mockito.CALLS_REAL_METHODS);
|
||||
JWTClient jwtClient = Mockito.mock(JWTClient.class, Mockito.CALLS_REAL_METHODS);
|
||||
doReturn(accessTokenInfo).when(jwtClient).getAccessToken(Mockito.anyString(), Mockito.anyString(),
|
||||
Mockito.anyString(), Mockito.anyString());
|
||||
@ -112,10 +116,10 @@ public abstract class BaseAPIPublisherTest {
|
||||
APIPublisherDataHolder.getInstance().setRealmService(realmService);
|
||||
RegistryDataHolder.getInstance().setRealmService(realmService);
|
||||
JWTClientExtensionDataHolder.getInstance().setRealmService(realmService);
|
||||
InputStream is = this.getClass().getClassLoader().getResourceAsStream("carbon-home/repository/conf/registry.xml");
|
||||
InputStream is = this.getClass().getClassLoader().getResourceAsStream("carbon-home/repository/" +
|
||||
"conf/registry.xml");
|
||||
RegistryContext context = RegistryContext.getBaseInstance(is, realmService);
|
||||
context.setSetup(true);
|
||||
return context.getEmbeddedRegistryService();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,57 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
#
|
||||
# WSO2 Inc. licenses this file to you under the Apache License,
|
||||
# Version 2.0 (the "License"); you may not use this file except
|
||||
# in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
#issuer of the JWT
|
||||
iss=wso2.org/products/iot
|
||||
|
||||
TokenEndpoint=https://${iot.gateway.host}:${iot.gateway.https.port}/token?tenantDomain=carbon.super
|
||||
|
||||
#audience of JWT claim
|
||||
#comma seperated values
|
||||
aud=devicemgt
|
||||
|
||||
#expiration time of JWT (number of minutes from the current time)
|
||||
exp=1000
|
||||
|
||||
#issued at time of JWT (number of minutes from the current time)
|
||||
iat=0
|
||||
|
||||
#nbf time of JWT (number of minutes from current time)
|
||||
nbf=0
|
||||
|
||||
#skew between IDP and issuer(seconds)
|
||||
skew=0
|
||||
|
||||
# JWT Id
|
||||
#jti=token123
|
||||
|
||||
#KeyStore to cryptographic credentials
|
||||
#KeyStore=repository/resources/security/wso2carbon.jks
|
||||
|
||||
#Password of the KeyStore
|
||||
#KeyStorePassword=wso2carbon
|
||||
|
||||
#Alias of the SP's private key
|
||||
#PrivateKeyAlias=wso2carbon
|
||||
|
||||
#Private key password to retrieve the private key used to sign
|
||||
#AuthnRequest and LogoutRequest messages
|
||||
#PrivateKeyPassword=wso2carbon
|
||||
|
||||
#this will be used as the default IDP config if there isn't any config available for tenants.
|
||||
default-jwt-client=true
|
||||
@ -1,57 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
#
|
||||
# WSO2 Inc. licenses this file to you under the Apache License,
|
||||
# Version 2.0 (the "License"); you may not use this file except
|
||||
# in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
#issuer of the JWT
|
||||
iss=wso2.org/products/iot
|
||||
|
||||
TokenEndpoint=https://${iot.gateway.host}:${iot.gateway.https.port}/token?tenantDomain=carbon.super
|
||||
|
||||
#audience of JWT claim
|
||||
#comma seperated values
|
||||
aud=devicemgt
|
||||
|
||||
#expiration time of JWT (number of minutes from the current time)
|
||||
exp=1000
|
||||
|
||||
#issued at time of JWT (number of minutes from the current time)
|
||||
iat=0
|
||||
|
||||
#nbf time of JWT (number of minutes from current time)
|
||||
nbf=0
|
||||
|
||||
#skew between IDP and issuer(seconds)
|
||||
skew=0
|
||||
|
||||
# JWT Id
|
||||
#jti=token123
|
||||
|
||||
#KeyStore to cryptographic credentials
|
||||
#KeyStore=repository/resources/security/wso2carbon.jks
|
||||
|
||||
#Password of the KeyStore
|
||||
#KeyStorePassword=wso2carbon
|
||||
|
||||
#Alias of the SP's private key
|
||||
#PrivateKeyAlias=wso2carbon
|
||||
|
||||
#Private key password to retrieve the private key used to sign
|
||||
#AuthnRequest and LogoutRequest messages
|
||||
#PrivateKeyPassword=wso2carbon
|
||||
|
||||
#this will be used as the default IDP config if there isn't any config available for tenants.
|
||||
default-jwt-client=true
|
||||
Loading…
Reference in New Issue
Block a user