Skip to content

Commit

Permalink
Adds REST API CORS configuration file in karaf distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
bostko authored and Valentin Aitken committed Jan 22, 2017
1 parent b2fd61f commit a570e1e
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 9 deletions.
27 changes: 18 additions & 9 deletions karaf/apache-brooklyn/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,24 @@
<outputDirectory>${project.build.directory}/assembly/etc</outputDirectory>
<destFileName>${project.groupId}.core.catalog.bomscanner.cfg</destFileName>
</artifactItem>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>brooklyn-dist-config</artifactId>
<version>${project.version}</version>
<classifier>osgilauncher</classifier>
<type>cfg</type>
<outputDirectory>${project.build.directory}/assembly/etc</outputDirectory>
<destFileName>${project.groupId}.osgilauncher.cfg</destFileName>
</artifactItem>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>brooklyn-dist-config</artifactId>
<version>${project.version}</version>
<classifier>osgilauncher</classifier>
<type>cfg</type>
<outputDirectory>${project.build.directory}/assembly/etc</outputDirectory>
<destFileName>${project.groupId}.osgilauncher.cfg</destFileName>
</artifactItem>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>brooklyn-dist-config</artifactId>
<version>${project.version}</version>
<classifier>rest.filter.cors</classifier>
<type>cfg</type>
<outputDirectory>${project.build.directory}/assembly/etc</outputDirectory>
<destFileName>${project.groupId}.rest.filter.cors.cfg</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
Expand Down
7 changes: 7 additions & 0 deletions karaf/config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@
<type>cfg</type>
<classifier>osgilauncher</classifier>
</artifact>
<artifact>
<file>
${project.basedir}/src/main/resources/org.apache.brooklyn.rest.filter.cors.cfg
</file>
<type>cfg</type>
<classifier>rest.filter.cors</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
################################################################################
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF 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.
#
################################################################################

# Enables experimental support for Cross Origin Resource Sharing (CORS) filtering in Apache Brooklyn REST API.
# Disabled by default.
# cors.enabled=false

# @see CrossOriginResourceSharingFilter#setAllowOrigins(List<String>)
# Coma separated values list of allowed origins. Access-Control-Allow-Origin header will be returned to client if Origin header in request is matching exactly a value among the list allowed origins.
# If empty or not specified then all origins are allowed. No wildcard allowed origins are supported.
# Example:
# cors.allow.origins=http://foo.bar, http://foo1.bar

# @see CrossOriginResourceSharingFilter#setAllowHeaders(List<String>)
# Coma separated values list of allowed headers for preflight checks.
# cors.allow.headers=

# @see CrossOriginResourceSharingFilter#setAllowCredentials(boolean)
# The value for the Access-Control-Allow-Credentials header. If false, no header is added.
# If true, the header is added with the value 'true'. False by default.
# cors.allow.credentials=false

# @see CrossOriginResourceSharingFilter#setExposeHeaders(List<String>)
# CSV list of non-simple headers to be exposed via Access-Control-Expose-Headers.
# cors.expose.headers=

# @see CrossOriginResourceSharingFilter#setMaxAge(Integer)
# The value for Access-Control-Max-Age. If -1 then No Access-Control-Max-Age header will be send.
# cors.max.age=-1

# @see CrossOriginResourceSharingFilter#setPreflightErrorStatus(Integer)
# Preflight error response status, default is 200.
# cors.preflight.error.status=200

# Do not apply CORS if response is going to be with UNAUTHORIZED status.
# cors.block.if.unauthorized=false
3 changes: 3 additions & 0 deletions karaf/features/src/main/feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
<configfile finalname="${karaf.etc}/${groupId}.osgilauncher.cfg" override="false">
mvn:${project.groupId}/brooklyn-dist-config/${project.version}/cfg/osgilauncher
</configfile>
<configfile finalname="${karaf.etc}/${groupId}.rest.filter.cors.cfg">
mvn:${project.groupId}/brooklyn-dist-config/${project.version}/cfg/rest.filter.cors
</configfile>
</feature>

<feature name="brooklyn-headless" version="${project.version}" description="All Brooklyn bundles witht the exception of the launcher">
Expand Down

0 comments on commit a570e1e

Please sign in to comment.