Skip to content

Commit ff37a4e

Browse files
committed
Merge branch 'client-certificate-mapper' into 3.x
2 parents 8de8339 + 21bc414 commit ff37a4e

File tree

6 files changed

+110
-1
lines changed

6 files changed

+110
-1
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Cloud Foundry Java Buildpack
2+
# Copyright 2013-2017 the original author or authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Container security provider configuration
17+
---
18+
version: 1.+
19+
repository_root: "{default.repository.root}/client-certificate-mapper"

config/components.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jres:
3939

4040
frameworks:
4141
- "JavaBuildpack::Framework::AppDynamicsAgent"
42+
- "JavaBuildpack::Framework::ClientCertificateMapper"
4243
- "JavaBuildpack::Framework::ContainerCustomizer"
4344
- "JavaBuildpack::Framework::ContainerSecurityProvider"
4445
- "JavaBuildpack::Framework::ContrastSecurityAgent"

java-buildpack.iml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@
269269
<orderEntry type="sourceFolder" forTests="false" />
270270
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.5.1, rbenv: 2.2.7) [gem]" level="application" />
271271
<orderEntry type="library" scope="PROVIDED" name="ast (v2.3.0, rbenv: 2.2.7) [gem]" level="application" />
272-
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.15.1, rbenv: 2.2.7) [gem]" level="application" />
273272
<orderEntry type="library" scope="PROVIDED" name="crack (v0.4.3, rbenv: 2.2.7) [gem]" level="application" />
274273
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, rbenv: 2.2.7) [gem]" level="application" />
275274
<orderEntry type="library" scope="PROVIDED" name="hashdiff (v0.3.4, rbenv: 2.2.7) [gem]" level="application" />
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Cloud Foundry Java Buildpack
2+
# Copyright 2013-2017 the original author or authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
require 'java_buildpack/component/versioned_dependency_component'
17+
require 'java_buildpack/framework'
18+
19+
module JavaBuildpack
20+
module Framework
21+
22+
# Encapsulates the functionality for contributing an mTLS client certificate mapper to the application.
23+
class ClientCertificateMapper < JavaBuildpack::Component::VersionedDependencyComponent
24+
25+
# (see JavaBuildpack::Component::BaseComponent#compile)
26+
def compile
27+
download_jar
28+
@droplet.additional_libraries << (@droplet.sandbox + jar_name)
29+
end
30+
31+
# (see JavaBuildpack::Component::BaseComponent#release)
32+
def release
33+
@droplet.additional_libraries << (@droplet.sandbox + jar_name)
34+
end
35+
36+
protected
37+
38+
# (see JavaBuildpack::Component::VersionedDependencyComponent#supports?)
39+
def supports?
40+
true
41+
end
42+
43+
end
44+
45+
end
46+
end
341 Bytes
Binary file not shown.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Cloud Foundry Java Buildpack
2+
# Copyright 2013-2017 the original author or authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
require 'spec_helper'
17+
require 'component_helper'
18+
require 'java_buildpack/framework/client_certificate_mapper'
19+
20+
describe JavaBuildpack::Framework::ClientCertificateMapper do
21+
include_context 'component_helper'
22+
23+
it 'always detects' do
24+
expect(component.detect).to eq("client-certificate-mapper=#{version}")
25+
end
26+
27+
it 'adds the jar to the additional libraries during compile',
28+
cache_fixture: 'stub-client-certificate-mapper.jar' do
29+
30+
component.compile
31+
32+
expect(sandbox + "client_certificate_mapper-#{version}.jar").to exist
33+
expect(additional_libraries).to include(sandbox + "client_certificate_mapper-#{version}.jar")
34+
end
35+
36+
it 'adds the jar to the additional libraries during release',
37+
cache_fixture: 'stub-client-certificate-mapper.jar' do
38+
39+
component.release
40+
41+
expect(additional_libraries).to include(sandbox + "client_certificate_mapper-#{version}.jar")
42+
end
43+
44+
end

0 commit comments

Comments
 (0)