Skip to content

Commit

Permalink
Add api resource mgt api
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaminduR committed Aug 9, 2023
1 parent 0446390 commit 2b15c2e
Show file tree
Hide file tree
Showing 35 changed files with 5,277 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<!--
~ Copyright (c) 2020, 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.
-->

<FindBugsFilter>
<Match>
<Bug pattern="CRLF_INJECTION_LOGS" />
</Match>
<Match>
<Bug pattern="FORMAT_STRING_MANIPULATION" />
</Match>
<Match>
<Bug pattern="JAXRS_ENDPOINT" />
</Match>
<!-- Excluded since this bug is fixed in Java 8+ versions :
https://find-sec-bugs.github.io/bugs.htm#WEAK_FILENAMEUTILS -->
<Match>
<Bug pattern="WEAK_FILENAMEUTILS" />
</Match>
<FindBugsFilter>
<Match>
<Class name="org.wso2.carbon.identity.api.server.application.management.common.ApplicationManagementConstants" />
<Bug pattern="HARD_CODE_PASSWORD" />
</Match>
</FindBugsFilter>
<FindBugsFilter>
<Match>
<Class name="org.wso2.carbon.identity.api.server.keystore.management.v1.core.KeyStoreService" />
<Bug pattern="PATH_TRAVERSAL_IN" />
</Match>
</FindBugsFilter>
<!-- Excluded since false positive. -->
<FindBugsFilter>
<Match>
<Class name="org.wso2.carbon.identity.api.server.configs.common.SchemaConfigParser" />
<Bug pattern="PATH_TRAVERSAL_IN" />
</Match>
</FindBugsFilter>
<FindBugsFilter>
<Match>
<Class name="org.wso2.carbon.identity.rest.api.server.challenge.v1.core.ServerChallengeService" />
<Method name="patchChallengeSet" />
<Bug pattern="IMPROPER_UNICODE" />
</Match>
</FindBugsFilter>
<FindBugsFilter>
<Match>
<Class name="org.wso2.carbon.identity.api.server.application.management.v1.core.functions.application.ServiceProviderToApiModel" />
<Method name="isResidentSp" />
<Bug pattern="IMPROPER_UNICODE" />
</Match>
</FindBugsFilter>
<FindBugsFilter>
<Match>
<Class name="org.wso2.carbon.identity.api.server.application.management.v1.core.functions.application.UpdateAuthenticationSequence" />
<Method name="isRevertToDefaultSequence" />
<Bug pattern="IMPROPER_UNICODE" />
</Match>
</FindBugsFilter>
<FindBugsFilter>
<Match>
<Class name="org.wso2.carbon.identity.api.server.tenant.management.v1.core.ServerTenantManagementService" />
<Method name="createTenantInfoBean" />
<Bug pattern="IMPROPER_UNICODE" />
</Match>
</FindBugsFilter>
<FindBugsFilter>
<Match>
<Class name="org.wso2.carbon.identity.api.server.tenant.management.v1.core.ServerTenantManagementService" />
<Method name="validateInputAgainstCode" />
<Bug pattern="IMPROPER_UNICODE" />
</Match>
</FindBugsFilter>

<FindBugsFilter>
<Match>
<Class name="org.wso2.carbon.identity.rest.api.server.claim.management.v1.core.ServerClaimManagementService" />
<Method name="validateAttributeMappings" />
<Bug pattern="IMPROPER_UNICODE" />
</Match>
</FindBugsFilter>
<FindBugsFilter>
<Match>
<Class name="org.wso2.carbon.identity.api.server.application.management.v1.core.functions.Utils" />
<Method name="deepCopyApplication" />
<Bug pattern="OBJECT_DESERIALIZATION" />
</Match>
</FindBugsFilter>
<FindBugsFilter>
<Match>
<Class name="org.wso2.carbon.identity.api.server.script.library.v1.core.ServerScriptLibrariesService" />
<Or>
<Method name="addScriptLibrary" />
<Method name="updateScriptLibrary" />
</Or>
<Bug pattern="PATH_TRAVERSAL_IN" />
</Match>
</FindBugsFilter>
<!--
The following exclusions are added as in java 11 and java 17,
findbugs shows the bug of unused fields, but the unused fields
cannot be removed as they are used inside unused but public classes.
-->
<FindBugsFilter>
<Match>
<Class name="org.wso2.carbon.identity.rest.api.server.challenge.v1.ApiException" />
<Bug pattern="URF_UNREAD_FIELD"/>
</Match>
</FindBugsFilter>
</FindBugsFilter>
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
~
~ WSO2 LLC. 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.
-->
<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">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.api.resource</artifactId>
<version>1.2.67-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.api.resource.common</artifactId>
<version>1.2.67-SNAPSHOT</version>
<packaging>jar</packaging>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.identity.application.mgt</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.identity.api.resource.mgt</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. 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.
*/

package org.wso2.carbon.identity.api.server.api.resource.common;

import org.wso2.carbon.identity.api.resource.mgt.ApiResourceManager;

/**
* Service holder class for api resource management.
*/
public class ApiResourceManagementServiceHolder {



private static ApiResourceManager apiResourceManager;

/**
* Get ApiResourceManager osgi service.
*
* @return ApiResourceManager.
*/
public static ApiResourceManager getApiResourceManager() {

return apiResourceManager;
}

/**
* Set ApiResourceManager osgi service.
*
* @param apiResourceManager ApiResourceManager.
*/
public static void setApiResourceManager(ApiResourceManager apiResourceManager) {

ApiResourceManagementServiceHolder.apiResourceManager = apiResourceManager;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. 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.
*/

package org.wso2.carbon.identity.api.server.api.resource.common.factory;

import org.springframework.beans.factory.config.AbstractFactoryBean;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.api.resource.mgt.ApiResourceManager;

/**
* Factory class for ApiResourceManagementOSGiService.
*/
public class ApiResourceManagementOSGiServiceFactory extends AbstractFactoryBean<ApiResourceManager> {

private ApiResourceManager apiResourceManager;

@Override
public Class<?> getObjectType() {

return Object.class;
}

@Override
protected ApiResourceManager createInstance() throws Exception {

if (this.apiResourceManager == null) {
ApiResourceManager taskOperationService = (ApiResourceManager) PrivilegedCarbonContext.
getThreadLocalCarbonContext().getOSGiService(ApiResourceManager.class, null);
if (taskOperationService != null) {
this.apiResourceManager = taskOperationService;
} else {
throw new Exception("Unable to retrieve ApiResourceManager service.");
}
}
return this.apiResourceManager;
}
}
Loading

0 comments on commit 2b15c2e

Please sign in to comment.