equals is checked to detect change in definitions
27 | */
28 | public interface CredentialsDefinition {
29 | String getName();
30 | }
31 |
--------------------------------------------------------------------------------
/kork-credentials-api/src/main/java/com/netflix/spinnaker/credentials/definition/CredentialsDefinitionSource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Armory
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 |
17 | package com.netflix.spinnaker.credentials.definition;
18 |
19 | import com.netflix.spinnaker.kork.plugins.api.internal.SpinnakerExtensionPoint;
20 | import java.util.List;
21 |
22 | /**
23 | * A source of credentials definitions. It could be backed by Spring properties or fetched from an
24 | * external system.
25 | *
26 | * @param If left null, the default object pool as defined in {@code JedisClientConfiguration} will be
32 | * used.
33 | */
34 | public GenericObjectPoolConfig poolConfig;
35 | }
36 |
--------------------------------------------------------------------------------
/kork-jedis/src/main/java/com/netflix/spinnaker/kork/jedis/RedisClientDelegateFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 Netflix, Inc.
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 | package com.netflix.spinnaker.kork.jedis;
17 |
18 | import com.netflix.spinnaker.kork.jedis.RedisClientConfiguration.Driver;
19 | import java.util.Map;
20 |
21 | public interface RedisClientDelegateFactory A service may expose additional SDKs that are specific to itself.
22 | */
23 | public interface ServiceSdk {}
24 |
--------------------------------------------------------------------------------
/kork-plugins-spring-api/kork-plugins-spring-api.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Netflix, Inc.
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 |
17 | apply plugin: "java-library"
18 | apply from: "${project.rootDir}/gradle/kotlin-test.gradle"
19 |
20 | dependencies {
21 | api(platform(project(":spinnaker-dependencies")))
22 |
23 | api project(":kork-plugins-api")
24 | api "org.springframework.boot:spring-boot-starter-web"
25 | api "org.springframework.boot:spring-boot-actuator"
26 |
27 | testImplementation "org.springframework.boot:spring-boot-starter-test"
28 | }
29 |
--------------------------------------------------------------------------------
/kork-plugins-spring-api/src/main/java/com/netflix/spinnaker/kork/plugins/api/spring/BeanPromoter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Armory, Inc.
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 |
17 | package com.netflix.spinnaker.kork.plugins.api.spring;
18 |
19 | public interface BeanPromoter {
20 | void promote(String beanName, Object bean, Class beanClass, boolean isPrimary);
21 | }
22 |
--------------------------------------------------------------------------------
/kork-plugins-spring-api/src/main/java/com/netflix/spinnaker/kork/plugins/api/spring/ExposeToApp.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Armory, Inc.
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 |
17 | package com.netflix.spinnaker.kork.plugins.api.spring;
18 |
19 | import java.lang.annotation.*;
20 |
21 | /** Indicates that a plugin bean should be elevated to the application's context. */
22 | @Target({ElementType.TYPE, ElementType.METHOD})
23 | @Retention(RetentionPolicy.RUNTIME)
24 | @Documented
25 | public @interface ExposeToApp {}
26 |
--------------------------------------------------------------------------------
/kork-plugins-spring-api/src/test/kotlin/com/netflix/spinnaker/kork/plugins/api/spring/TestPrivilegedSpringPlugin.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Armory, Inc.
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 |
17 | package com.netflix.spinnaker.kork.plugins.api.spring
18 |
19 | import org.pf4j.PluginWrapper
20 | import org.springframework.beans.factory.support.BeanDefinitionRegistry
21 |
22 | internal class TestPrivilegedSpringPlugin(wrapper: PluginWrapper) : PrivilegedSpringPlugin(wrapper) {
23 |
24 | override fun registerBeanDefinitions(registry: BeanDefinitionRegistry) {
25 | registerBean(primaryBeanDefinitionFor(MyService::class.java), registry)
26 | }
27 |
28 | internal class MyService
29 | }
30 |
--------------------------------------------------------------------------------
/kork-plugins-spring-api/src/test/kotlin/com/netflix/spinnaker/kork/plugins/api/spring/TestSpringLoaderPlugin.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Armory, Inc.
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 |
17 | package com.netflix.spinnaker.kork.plugins.api.spring
18 |
19 | import org.pf4j.PluginWrapper
20 |
21 | internal class TestSpringLoaderPlugin(wrapper: PluginWrapper) : SpringLoaderPlugin(wrapper) {
22 |
23 |
24 | override fun getPackagesToScan(): List {
21 | /** acknowledges that a message has been successfully processed */
22 | void ack(S subscriptionInformation, T message);
23 |
24 | /** negative-acknowledge, when there was an error processing the message */
25 | void nack(S subscriptionInformation, T message);
26 | }
27 |
--------------------------------------------------------------------------------
/kork-pubsub/src/main/java/com/netflix/spinnaker/kork/pubsub/model/PubsubSubscriber.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Netflix, Inc.
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 |
17 | package com.netflix.spinnaker.kork.pubsub.model;
18 |
19 | /**
20 | * One subscriber exists for each subscription, and facilitates getting messages from the
21 | * subscription.
22 | */
23 | public interface PubsubSubscriber {
24 | String getPubsubSystem();
25 |
26 | String getSubscriptionName();
27 |
28 | String getName();
29 | }
30 |
--------------------------------------------------------------------------------
/kork-retrofit/kork-retrofit.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "java-library"
2 | apply from: "$rootDir/gradle/kotlin-test.gradle"
3 | apply from: "$rootDir/gradle/lombok.gradle"
4 |
5 | dependencies {
6 | api(platform(project(":spinnaker-dependencies")))
7 | api "com.squareup.retrofit:retrofit"
8 | api "com.squareup.retrofit2:retrofit"
9 |
10 | implementation project(":kork-web")
11 |
12 | implementation "com.jakewharton.retrofit:retrofit1-okhttp3-client"
13 | implementation "com.squareup.retrofit:converter-jackson"
14 | implementation "io.zipkin.brave:brave-instrumentation-okhttp3"
15 | implementation "com.squareup.retrofit2:converter-jackson"
16 | implementation "com.squareup.okhttp3:logging-interceptor"
17 | implementation "com.google.guava:guava"
18 |
19 | testImplementation project(":kork-test")
20 | testImplementation "org.spockframework:spock-core"
21 | testImplementation "org.spockframework:spock-spring"
22 | testImplementation "org.springframework.boot:spring-boot-starter-test"
23 | testImplementation "com.netflix.spectator:spectator-reg-micrometer"
24 | testImplementation "com.squareup.okhttp3:mockwebserver"
25 | testRuntimeOnly "cglib:cglib-nodep"
26 | testRuntimeOnly "org.objenesis:objenesis"
27 | }
28 |
--------------------------------------------------------------------------------
/kork-retrofit/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/kork-retrofit/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.netflix.spinnaker.kork.retrofit.RetrofitServiceFactoryAutoConfiguration
2 |
--------------------------------------------------------------------------------
/kork-retrofit/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker:
--------------------------------------------------------------------------------
1 | mock-maker-inline
2 |
--------------------------------------------------------------------------------
/kork-retrofit2/kork-retrofit2.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "java-library"
2 | apply from: "$rootDir/gradle/kotlin-test.gradle"
3 |
4 | dependencies {
5 | api(platform(project(":spinnaker-dependencies")))
6 | implementation project(":kork-web")
7 | implementation project(":kork-retrofit")
8 | implementation "com.squareup.retrofit2:retrofit"
9 | implementation "com.squareup.retrofit2:converter-jackson"
10 | implementation "com.squareup.okhttp3:logging-interceptor"
11 | implementation "io.zipkin.brave:brave-instrumentation-okhttp3"
12 |
13 | testImplementation "org.springframework.boot:spring-boot-starter-test"
14 | testRuntimeOnly "cglib:cglib-nodep"
15 | testRuntimeOnly "org.objenesis:objenesis"
16 |
17 | testImplementation "com.squareup.okhttp3:mockwebserver"
18 | testImplementation "com.squareup.retrofit2:retrofit-mock"
19 | testImplementation "com.github.tomakehurst:wiremock-jre8"
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/kork-retrofit2/src/main/java/com/netflix/spinnaker/kork/retrofit/Retrofit2ConfigurationProperties.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Netflix, Inc.
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 | */
17 |
18 | package com.netflix.spinnaker.kork.retrofit;
19 |
20 | import okhttp3.logging.HttpLoggingInterceptor;
21 | import org.springframework.boot.context.properties.ConfigurationProperties;
22 |
23 | @ConfigurationProperties("retrofit2")
24 | public class Retrofit2ConfigurationProperties {
25 |
26 | private HttpLoggingInterceptor.Level logLevel = HttpLoggingInterceptor.Level.BASIC;
27 |
28 | public HttpLoggingInterceptor.Level getLogLevel() {
29 | return logLevel;
30 | }
31 |
32 | public void setLogLevel(HttpLoggingInterceptor.Level logLevel) {
33 | this.logLevel = logLevel;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/kork-retrofit2/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/kork-retrofit2/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.netflix.spinnaker.kork.retrofit.Retrofit2ServiceFactoryAutoConfiguration
2 |
--------------------------------------------------------------------------------
/kork-runtime/README.md:
--------------------------------------------------------------------------------
1 | # kork-runtime
2 |
3 | This module serves as a collection of the runtime dependencies in the kork
4 | project that should be added to the service module for a standard Spinnaker
5 | service - similar to a spring-boot-starter style module for Spinnaker
6 | services.
7 |
8 | As we add new or refactor existing runtime only dependencies we can collect
9 | the dependencies here so that as we autobump out kork releases services will
10 | pick up those changes.
11 |
12 |
--------------------------------------------------------------------------------
/kork-runtime/kork-runtime.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | runtimeOnly(platform(project(":spinnaker-dependencies")))
3 |
4 | // Add each included runtime project as a runtime dependency
5 | gradle.includedRuntimeProjects.each {
6 | runtimeOnly project(it)
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/kork-secrets-aws/kork-secrets-aws.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "java-library"
2 | apply from: "$rootDir/gradle/lombok.gradle"
3 |
4 | dependencies {
5 | api(platform(project(":spinnaker-dependencies")))
6 |
7 | api project(':kork-secrets')
8 |
9 | implementation "com.amazonaws:aws-java-sdk-s3"
10 | implementation "com.amazonaws:aws-java-sdk-secretsmanager"
11 | implementation "org.apache.commons:commons-lang3"
12 | implementation "org.springframework.boot:spring-boot-autoconfigure"
13 |
14 | runtimeOnly "com.amazonaws:aws-java-sdk-sts"
15 |
16 | testImplementation "org.junit.jupiter:junit-jupiter-api"
17 | testImplementation "org.mockito:mockito-core"
18 | testImplementation "org.mockito:mockito-junit-jupiter"
19 | testImplementation "org.testcontainers:localstack"
20 | testImplementation "org.springframework:spring-test"
21 | testImplementation "org.springframework.boot:spring-boot-test"
22 | testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
23 | }
24 |
--------------------------------------------------------------------------------
/kork-secrets/kork-secrets.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "java-library"
2 | apply plugin: "groovy"
3 | apply from: "$rootDir/gradle/lombok.gradle"
4 |
5 | dependencies {
6 | api(platform(project(":spinnaker-dependencies")))
7 |
8 | api project(":kork-core")
9 | api project(":kork-security")
10 | api "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml"
11 | api "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor"
12 | implementation "org.springframework.boot:spring-boot-autoconfigure"
13 | implementation "org.springframework.boot:spring-boot-starter-actuator"
14 | implementation "org.yaml:snakeyaml"
15 | implementation "com.google.guava:guava"
16 | implementation "org.apache.commons:commons-lang3"
17 | implementation "org.apache.logging.log4j:log4j-api"
18 |
19 | testImplementation "com.hubspot.jinjava:jinjava"
20 | testImplementation "org.spockframework:spock-core"
21 | testImplementation "org.junit.jupiter:junit-jupiter-api"
22 | testRuntimeOnly "cglib:cglib-nodep"
23 | testRuntimeOnly "org.objenesis:objenesis"
24 | testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
25 |
26 | testImplementation("org.springframework:spring-test")
27 | testImplementation("org.springframework.boot:spring-boot-test")
28 | testImplementation("org.mockito:mockito-core")
29 | testImplementation("org.mockito:mockito-junit-jupiter")
30 | }
31 |
--------------------------------------------------------------------------------
/kork-secrets/src/main/java/com/netflix/spinnaker/kork/secrets/InvalidSecretFormatException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Armory, Inc.
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 |
17 | package com.netflix.spinnaker.kork.secrets;
18 |
19 | public class InvalidSecretFormatException extends SecretException {
20 |
21 | public InvalidSecretFormatException() {
22 | super();
23 | }
24 |
25 | public InvalidSecretFormatException(String message) {
26 | super(message);
27 | }
28 |
29 | public InvalidSecretFormatException(Throwable cause) {
30 | super(cause);
31 | }
32 |
33 | public InvalidSecretFormatException(String message, Throwable cause) {
34 | super(message, cause);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/kork-secrets/src/main/java/com/netflix/spinnaker/kork/secrets/SecretDecryptionException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Armory, Inc.
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 |
17 | package com.netflix.spinnaker.kork.secrets;
18 |
19 | public class SecretDecryptionException extends SecretException {
20 |
21 | public SecretDecryptionException() {}
22 |
23 | public SecretDecryptionException(String message) {
24 | super(message);
25 | }
26 |
27 | public SecretDecryptionException(Throwable cause) {
28 | super(cause);
29 | }
30 |
31 | public SecretDecryptionException(String message, Throwable cause) {
32 | super(message, cause);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/kork-secrets/src/main/java/com/netflix/spinnaker/kork/secrets/SecretException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Armory, Inc.
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 |
17 | package com.netflix.spinnaker.kork.secrets;
18 |
19 | public class SecretException extends RuntimeException {
20 |
21 | public SecretException() {
22 | super();
23 | }
24 |
25 | public SecretException(String message) {
26 | super(message);
27 | }
28 |
29 | public SecretException(Throwable cause) {
30 | super(cause);
31 | }
32 |
33 | public SecretException(String message, Throwable cause) {
34 | super(message, cause);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/kork-secrets/src/main/java/com/netflix/spinnaker/kork/secrets/StandardSecretParameter.java:
--------------------------------------------------------------------------------
1 | package com.netflix.spinnaker.kork.secrets;
2 |
3 | import javax.annotation.Nonnull;
4 | import lombok.Getter;
5 |
6 | public enum StandardSecretParameter {
7 | KEY("k"),
8 | ENCODING("e");
9 |
10 | @Getter @Nonnull private final String parameterName;
11 |
12 | StandardSecretParameter(String parameterName) {
13 | this.parameterName = parameterName;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/kork-secrets/src/main/java/com/netflix/spinnaker/kork/secrets/user/StringUserSecretData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Apple Inc.
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 |
17 | package com.netflix.spinnaker.kork.secrets.user;
18 |
19 | import com.netflix.spinnaker.kork.annotations.NonnullByDefault;
20 | import lombok.RequiredArgsConstructor;
21 |
22 | @NonnullByDefault
23 | @RequiredArgsConstructor
24 | // not using @UserSecretType as this is an unstructured type
25 | // see StringUserSecretSerde
26 | public class StringUserSecretData implements UserSecretData {
27 | private final String data;
28 |
29 | @Override
30 | public String getSecretString(String key) {
31 | return data;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/kork-secrets/src/main/java/com/netflix/spinnaker/kork/secrets/user/UserSecretData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Apple Inc.
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 |
17 | package com.netflix.spinnaker.kork.secrets.user;
18 |
19 | import com.netflix.spinnaker.kork.annotations.NonnullByDefault;
20 |
21 | @NonnullByDefault
22 | public interface UserSecretData {
23 | /** Gets the value of this secret with the provided key and returns a string encoding of it. */
24 | String getSecretString(String key);
25 | }
26 |
--------------------------------------------------------------------------------
/kork-secrets/src/main/java/com/netflix/spinnaker/kork/secrets/user/UserSecretMetadataField.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Apple Inc.
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 |
17 | package com.netflix.spinnaker.kork.secrets.user;
18 |
19 | import lombok.Getter;
20 |
21 | public enum UserSecretMetadataField {
22 | TYPE("type"),
23 | ENCODING("encoding"),
24 | ROLES("roles");
25 |
26 | public static final String PREFIX = "spinnaker:";
27 |
28 | @Getter private final String tagKey;
29 |
30 | UserSecretMetadataField(String tagKey) {
31 | this.tagKey = PREFIX + tagKey;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/kork-secrets/src/main/java/com/netflix/spinnaker/kork/secrets/user/UserSecretMixin.java:
--------------------------------------------------------------------------------
1 | package com.netflix.spinnaker.kork.secrets.user;
2 |
3 | import com.fasterxml.jackson.annotation.JsonTypeInfo;
4 |
5 | /**
6 | * Jackson mixin for {@link UserSecret} to support encoding and decoding user secrets based on a
7 | * provided {@code type} property.
8 | */
9 | @JsonTypeInfo(
10 | use = JsonTypeInfo.Id.NAME,
11 | include = JsonTypeInfo.As.EXISTING_PROPERTY,
12 | property = "type")
13 | public interface UserSecretMixin {}
14 |
--------------------------------------------------------------------------------
/kork-secrets/src/main/java/com/netflix/spinnaker/kork/secrets/user/UserSecretSerde.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Apple Inc.
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 |
17 | package com.netflix.spinnaker.kork.secrets.user;
18 |
19 | import com.netflix.spinnaker.kork.annotations.NonnullByDefault;
20 |
21 | @NonnullByDefault
22 | public interface UserSecretSerde {
23 | boolean supports(UserSecretMetadata metadata);
24 |
25 | UserSecret deserialize(byte[] encoded, UserSecretMetadata metadata);
26 |
27 | byte[] serialize(UserSecretData secret, UserSecretMetadata metadata);
28 | }
29 |
--------------------------------------------------------------------------------
/kork-secrets/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/kork-secrets/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.netflix.spinnaker.kork.secrets.SecretConfiguration
2 |
--------------------------------------------------------------------------------
/kork-security/kork-security.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "java-library"
2 | apply plugin: "groovy"
3 | apply from: "$rootDir/gradle/lombok.gradle"
4 |
5 | dependencies {
6 | api(platform(project(":spinnaker-dependencies")))
7 |
8 | implementation(project(":kork-core"))
9 |
10 | api "org.springframework.security:spring-security-core"
11 | api "com.fasterxml.jackson.core:jackson-annotations"
12 |
13 | implementation "com.google.guava:guava"
14 | implementation "org.apache.logging.log4j:log4j-api"
15 | implementation "org.slf4j:slf4j-api"
16 |
17 | testImplementation "org.spockframework:spock-core"
18 | testRuntimeOnly "ch.qos.logback:logback-classic"
19 | testRuntimeOnly "cglib:cglib-nodep"
20 | testRuntimeOnly "org.objenesis:objenesis"
21 | }
22 |
--------------------------------------------------------------------------------
/kork-security/src/main/java/com/netflix/spinnaker/security/AuthorizationMapControlled.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Apple, Inc.
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 | */
17 |
18 | package com.netflix.spinnaker.security;
19 |
20 | import javax.annotation.Nullable;
21 |
22 | /**
23 | * Common interface for access-controlled classes which use a permission map of {@link
24 | * Authorization} enums.
25 | */
26 | public interface AuthorizationMapControlled extends PermissionMapControlled