Provide an embedded Docker container for local development #1
@ -8,9 +8,7 @@ import se.su.dsv.oauth2.admin.repository.ClientRow;
|
|||||||
|
|
||||||
import java.security.Principal;
|
import java.security.Principal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@ -41,7 +39,6 @@ public class EmbeddedConfiguration {
|
|||||||
|
|
||||||
private static class InMemoryClientrepository implements ClientRepository {
|
private static class InMemoryClientrepository implements ClientRepository {
|
||||||
private List<ClientRow> clientRows;
|
private List<ClientRow> clientRows;
|
||||||
private Map<String, List<String>> clientOwners = new HashMap<>();
|
|
||||||
|
|
||||||
public InMemoryClientrepository(final List<ClientRow> clients) {
|
public InMemoryClientrepository(final List<ClientRow> clients) {
|
||||||
this.clientRows = new ArrayList<>(clients);
|
this.clientRows = new ArrayList<>(clients);
|
||||||
@ -59,19 +56,15 @@ public class EmbeddedConfiguration {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addClientOwner(final String principalName, final String id) {
|
public void addClientOwner(final String principalName, final String id) {
|
||||||
clientOwners.putIfAbsent(id, new ArrayList<>());
|
|
||||||
clientOwners.get(id).add(principalName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeOwner(final String id, final String owner) {
|
public void removeOwner(final String id, final String owner) {
|
||||||
clientOwners.putIfAbsent(id, new ArrayList<>());
|
|
||||||
clientOwners.get(id).remove(owner);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getOwners(final String id) {
|
public List<String> getOwners(final String id) {
|
||||||
return clientOwners.getOrDefault(id, List.of());
|
return List.of("dev@localhost");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user