Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,28 @@ on: [push, pull_request]
jobs:
build:
name: Build the project
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a good idea to use latest? I guess we can always fix the build if it breaks

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v5
with:
fetch-depth: 2

- name: Setup JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v5
with:
java-version: 17
java-package: jdk
distribution: adopt
architecture: x64

- name: Cache local Maven repository
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: mvn build
run: ./mvnw clean install -Djib.skip -B
6 changes: 3 additions & 3 deletions .github/workflows/release-patch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ on: [workflow_dispatch]
jobs:
build:
name: Release
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v5
with:
fetch-depth: 0
# We need a personal access token to be able to push to a protected branch
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}

- name: Setup JDK
uses: actions/setup-java@v2
uses: actions/setup-java@v5
with:
java-version: 17
java-package: jdk
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ on:
jobs:
build:
name: Release
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v5
with:
fetch-depth: 0
# We need a personal access token to be able to push to a protected branch
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}

- name: Setup JDK
uses: actions/setup-java@v2
uses: actions/setup-java@v5
with:
java-version: 17
java-package: jdk
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Expedia, Inc.
* Copyright (C) 2018-2025 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,9 +24,6 @@
import java.util.Set;
import java.util.function.Function;

import lombok.Value;
import lombok.extern.slf4j.Slf4j;

import org.springframework.stereotype.Component;

import com.expediagroup.streamplatform.streamregistry.core.validators.ValidationException;
Expand All @@ -47,6 +44,9 @@
import com.expediagroup.streamplatform.streamregistry.model.StreamBinding;
import com.expediagroup.streamplatform.streamregistry.model.Zone;

import lombok.Value;
import lombok.extern.slf4j.Slf4j;

@Component
@Slf4j
public class HandlerService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2021 Expedia, Inc.
* Copyright (C) 2018-2025 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,12 +15,12 @@
*/
package com.expediagroup.streamplatform.streamregistry.core.handlers;

import lombok.RequiredArgsConstructor;

import com.expediagroup.streamplatform.streamregistry.handler.Handler;
import com.expediagroup.streamplatform.streamregistry.model.Entity;
import com.expediagroup.streamplatform.streamregistry.model.Specification;

import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public class IdentityHandler<T extends Entity> implements Handler<T> {
public static final String DEFAULT = "default";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2024 Expedia, Inc.
* Copyright (C) 2018-2025 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,9 +21,6 @@
import java.util.Optional;
import java.util.function.Predicate;

import lombok.RequiredArgsConstructor;
import lombok.val;

import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize;
Expand All @@ -39,6 +36,9 @@
import com.expediagroup.streamplatform.streamregistry.model.keys.ConsumerKey;
import com.expediagroup.streamplatform.streamregistry.repository.ConsumerBindingRepository;

import lombok.RequiredArgsConstructor;
import lombok.val;

@Component
@RequiredArgsConstructor
public class ConsumerBindingService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2024 Expedia, Inc.
* Copyright (C) 2018-2025 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,9 +21,6 @@
import java.util.Optional;
import java.util.function.Predicate;

import lombok.RequiredArgsConstructor;
import lombok.val;

import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize;
Expand All @@ -39,6 +36,9 @@
import com.expediagroup.streamplatform.streamregistry.model.keys.ConsumerKey;
import com.expediagroup.streamplatform.streamregistry.repository.ConsumerRepository;

import lombok.RequiredArgsConstructor;
import lombok.val;

@Component
@RequiredArgsConstructor
public class ConsumerService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2024 Expedia, Inc.
* Copyright (C) 2018-2025 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,9 +21,6 @@
import java.util.Optional;
import java.util.function.Predicate;

import lombok.RequiredArgsConstructor;
import lombok.val;

import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize;
Expand All @@ -43,6 +40,9 @@
import com.expediagroup.streamplatform.streamregistry.model.keys.DomainKey;
import com.expediagroup.streamplatform.streamregistry.repository.DomainRepository;

import lombok.RequiredArgsConstructor;
import lombok.val;

@Component
@RequiredArgsConstructor
public class DomainService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2024 Expedia, Inc.
* Copyright (C) 2018-2025 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,9 +21,6 @@
import java.util.Optional;
import java.util.function.Predicate;

import lombok.RequiredArgsConstructor;
import lombok.val;

import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize;
Expand All @@ -43,6 +40,9 @@
import com.expediagroup.streamplatform.streamregistry.model.keys.InfrastructureKey;
import com.expediagroup.streamplatform.streamregistry.repository.InfrastructureRepository;

import lombok.RequiredArgsConstructor;
import lombok.val;

@Component
@RequiredArgsConstructor
public class InfrastructureService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2024 Expedia, Inc.
* Copyright (C) 2018-2025 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,9 +21,6 @@
import java.util.Optional;
import java.util.function.Predicate;

import lombok.RequiredArgsConstructor;
import lombok.val;

import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize;
Expand All @@ -38,6 +35,9 @@
import com.expediagroup.streamplatform.streamregistry.model.keys.ProcessBindingKey;
import com.expediagroup.streamplatform.streamregistry.repository.ProcessBindingRepository;

import lombok.RequiredArgsConstructor;
import lombok.val;

@Component
@RequiredArgsConstructor
public class ProcessBindingService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2024 Expedia, Inc.
* Copyright (C) 2018-2025 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,9 +21,6 @@
import java.util.Optional;
import java.util.function.Predicate;

import lombok.RequiredArgsConstructor;
import lombok.val;

import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize;
Expand All @@ -34,18 +31,18 @@
import com.expediagroup.streamplatform.streamregistry.core.validators.ValidationException;
import com.expediagroup.streamplatform.streamregistry.core.views.ProcessBindingView;
import com.expediagroup.streamplatform.streamregistry.core.views.ProcessView;
import com.expediagroup.streamplatform.streamregistry.model.Consumer;
import com.expediagroup.streamplatform.streamregistry.core.views.StreamView;
import com.expediagroup.streamplatform.streamregistry.model.*;
import com.expediagroup.streamplatform.streamregistry.model.Process;
import com.expediagroup.streamplatform.streamregistry.model.ProcessInputStream;
import com.expediagroup.streamplatform.streamregistry.model.ProcessOutputStream;
import com.expediagroup.streamplatform.streamregistry.model.Producer;
import com.expediagroup.streamplatform.streamregistry.model.Status;
import com.expediagroup.streamplatform.streamregistry.model.keys.ConsumerKey;
import com.expediagroup.streamplatform.streamregistry.model.keys.ProcessKey;
import com.expediagroup.streamplatform.streamregistry.model.keys.ProducerKey;
import com.expediagroup.streamplatform.streamregistry.model.keys.ZoneKey;
import com.expediagroup.streamplatform.streamregistry.repository.ProcessRepository;

import lombok.RequiredArgsConstructor;
import lombok.val;

@Component
@RequiredArgsConstructor
public class ProcessService {
Expand All @@ -57,6 +54,7 @@ public class ProcessService {
private final ProcessView processView;
private final ConsumerService consumerService;
private final ProducerService producerService;
private final StreamView streamView;

@PreAuthorize("hasPermission(#process, 'CREATE')")
public Optional<Process> create(Process process) throws ValidationException {
Expand All @@ -78,6 +76,11 @@ public Optional<Process> create(Process process) throws ValidationException {
}

private Producer buildProducer(Process process, ZoneKey zoneKey, ProcessOutputStream output) {
val stream = streamView.get(output.getStream());
if (stream.isEmpty()) {
throw new ValidationException("Can't authorize output for " + output.getStream() + " because the stream doesn't exist.");
}

return new Producer(
new ProducerKey(
output.getStream().getDomainKey().getName(),
Expand All @@ -86,7 +89,7 @@ private Producer buildProducer(Process process, ZoneKey zoneKey, ProcessOutputSt
zoneKey.getName(),
process.getKey().getName()
),
process.getSpecification(),
secureSpecification(process.getSpecification(), stream.get()),
process.getStatus()
);
}
Expand Down Expand Up @@ -123,6 +126,11 @@ public Optional<Process> update(Process process) throws ValidationException {
}

private Consumer buildConsumer(Process process, ZoneKey zoneKey, ProcessInputStream input) {
val stream = streamView.get(input.getStream());
if (stream.isEmpty()) {
throw new ValidationException("Can't authorize input for " + input.getStream() + " because the stream doesn't exist.");
}

return new Consumer(
new ConsumerKey(
input.getStream().getDomainKey().getName(),
Expand All @@ -131,11 +139,22 @@ private Consumer buildConsumer(Process process, ZoneKey zoneKey, ProcessInputStr
zoneKey.getName(),
process.getKey().getName()
),
process.getSpecification(),
secureSpecification(process.getSpecification(), stream.get()),
process.getStatus()
);
}

private Specification secureSpecification(Specification specification, Stream stream) {
return new Specification(
specification.getDescription(),
specification.getTags(),
specification.getType(),
specification.getConfiguration(),
stream.getSpecification().getSecurity(),
specification.getFunction()
);
}

@PreAuthorize("hasPermission(#process, 'UPDATE_STATUS')")
public Optional<Process> updateStatus(Process process, Status status) {
process.setStatus(status);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2018-2024 Expedia, Inc.
* Copyright (C) 2018-2025 Expedia, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,9 +21,6 @@
import java.util.Optional;
import java.util.function.Predicate;

import lombok.RequiredArgsConstructor;
import lombok.val;

import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize;
Expand All @@ -39,6 +36,9 @@
import com.expediagroup.streamplatform.streamregistry.model.keys.ProducerKey;
import com.expediagroup.streamplatform.streamregistry.repository.ProducerBindingRepository;

import lombok.RequiredArgsConstructor;
import lombok.val;

@Component
@RequiredArgsConstructor
public class ProducerBindingService {
Expand Down
Loading