mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
making the certificate management war adhere the REST API guidelines
This commit is contained in:
parent
f5aa2c5eb1
commit
d65174d026
@ -48,7 +48,7 @@
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<packagingExcludes>WEB-INF/lib/*cxf*.jar</packagingExcludes>
|
||||
<warName>admin-certificate</warName>
|
||||
<warName>api#certificate-mgt#v1.0</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
@ -75,7 +75,7 @@
|
||||
<copy todir="${basedir}/../../../repository/deployment/server/webapps"
|
||||
overwrite="true">
|
||||
<fileset dir="${basedir}/target">
|
||||
<include name="admin-certificate.war"/>
|
||||
<include name="api#certificate-mgt#v1.0.war"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</tasks>
|
||||
|
||||
@ -13,7 +13,7 @@ import javax.ws.rs.core.Response;
|
||||
|
||||
@Api(value = "Certificate Management", description = "This API carries all certificate management related operations " +
|
||||
"such as get all the available devices, etc.")
|
||||
@Path("/certificates")
|
||||
@Path("/admin/certificates")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public interface CertificateManagementAdminService {
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.util;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ApiOriginFilter implements Filter {
|
||||
|
||||
public void doFilter(ServletRequest request, ServletResponse response,
|
||||
FilterChain chain) throws IOException, ServletException {
|
||||
HttpServletResponse res = (HttpServletResponse) response;
|
||||
res.addHeader("Access-Control-Allow-Origin", "*");
|
||||
res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
|
||||
res.addHeader("Access-Control-Allow-Headers", "Content-Type");
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
}
|
||||
@ -26,6 +26,7 @@
|
||||
|
||||
<jaxrs:server id="services" address="/">
|
||||
<jaxrs:serviceBeans>
|
||||
<ref bean="certificateServiceBean"/>
|
||||
<ref bean="swaggerResource"/>
|
||||
</jaxrs:serviceBeans>
|
||||
<jaxrs:providers>
|
||||
@ -34,15 +35,6 @@
|
||||
<ref bean="swaggerWriter"/>
|
||||
</jaxrs:providers>
|
||||
</jaxrs:server>
|
||||
<jaxrs:server id="certificateService" address="/certificates">
|
||||
<jaxrs:serviceBeans>
|
||||
<ref bean="certificateServiceBean"/>
|
||||
</jaxrs:serviceBeans>
|
||||
<jaxrs:providers>
|
||||
<ref bean="jsonProvider"/>
|
||||
<ref bean="errorHandler"/>
|
||||
</jaxrs:providers>
|
||||
</jaxrs:server>
|
||||
|
||||
<bean id="swaggerWriter" class="io.swagger.jaxrs.listing.SwaggerSerializers"/>
|
||||
<bean id="swaggerResource" class="io.swagger.jaxrs.listing.ApiListingResource"/>
|
||||
@ -51,8 +43,9 @@
|
||||
<property name="resourcePackage" value="org.wso2.carbon.certificate.mgt.cert.jaxrs.api"/>
|
||||
<property name="version" value="1.0.0"/>
|
||||
<property name="host" value="localhost:9443"/>
|
||||
<property name="basePath" value="/"/>
|
||||
<property name="title" value="Device Management Admin Service API Definitions"/>
|
||||
<property name="schemes" value="https" />
|
||||
<property name="basePath" value="/api/certificate-mgt/v1.0"/>
|
||||
<property name="title" value="Certificate Management Admin Service API Definitions"/>
|
||||
<property name="contact" value="dev@wso2.org"/>
|
||||
<property name="license" value="Apache 2.0"/>
|
||||
<property name="licenseUrl" value="http://www.apache.org/licenses/LICENSE-2.0.html"/>
|
||||
|
||||
@ -25,6 +25,11 @@
|
||||
<servlet-class>
|
||||
org.apache.cxf.transport.servlet.CXFServlet
|
||||
</servlet-class>
|
||||
<init-param>
|
||||
<param-name>swagger.security.filter</param-name>
|
||||
<param-value>ApiAuthorizationFilterImpl</param-value>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>CXFServlet</servlet-name>
|
||||
@ -63,4 +68,14 @@
|
||||
</user-data-constraint>
|
||||
</security-constraint>
|
||||
|
||||
<filter>
|
||||
<filter-name>ApiOriginFilter</filter-name>
|
||||
<filter-class>org.wso2.carbon.certificate.mgt.cert.jaxrs.api.util.ApiOriginFilter</filter-class>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>ApiOriginFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
|
||||
</web-app>
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
<outputDirectory>
|
||||
${project.build.directory}/maven-shared-archive-resources/webapps
|
||||
</outputDirectory>
|
||||
<destFileName>admin-certificate.war</destFileName>
|
||||
<destFileName>api#certificate-mgt#v1.0.war</destFileName>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
instructions.configure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.certificate.mgt.cert.admin.api_${feature.version}/webapps/admin-certificate.war,target:${installFolder}/../../deployment/server/webapps/admin-certificate.war,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.certificate.mgt.cert.admin.api_${feature.version}/webapps/api#certificate-mgt#v1.0.war,target:${installFolder}/../../deployment/server/webapps/api#certificate-mgt#v1.0.war,overwrite:true);\
|
||||
Loading…
Reference in New Issue
Block a user