pax_global_header 0000666 0000000 0000000 00000000064 13574416570 0014526 g ustar 00root root 0000000 0000000 52 comment=ef9122a2c8730f6151cf11223d5eb20a294c8129
ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/ 0000775 0000000 0000000 00000000000 13574416570 0017525 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/.gitignore 0000664 0000000 0000000 00000001300 13574416570 0021507 0 ustar 00root root 0000000 0000000 .DS_Store
node_modules
gms-ui/dist
gms-ui/node/
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
HELP.md
gms/target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
nbactions.xml
### VS Code ###
.vscode/
/gms-ui/target/
/gms/nbactions-release-profile.xml
/gms-client/gms-client-lib/target/
/gms-client/gms-cli/target/
/gms/node/
ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/README.md 0000664 0000000 0000000 00000003326 13574416570 0021010 0 ustar 00root root 0000000 0000000 # IA2 GMS
## Database Docker image
To build the image run **from current directory**:
docker build -f database/Dockerfile --tag gms-db .
To start the image and use the database:
docker run -d -p 5432:5432 -i -t gms-db:latest
## GMS Docker image
To build the image:
mvn clean package dockerfile:build -DskipTests
To run:
docker run --env-file docker-env -d -p 8081:8081 -i -t gms:latest
## Command line clients
To add a command line client first generate the sha256 of its password:
echo -n password | sha256sum
Then insert the client line into the database:
INSERT INTO gms_client (client_id, client_secret, allowed_actions, ip_filter)
VALUES ('test', '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08', '{"*"}', NULL);
## Developer notes
Backend and frontend are 2 separate applications:
* the backend is the Maven application in the gms folder, based on Java and Spring Boot;
* the frontend is the npm application is the gms-ui folder, based on Vue.js.
The Maven application automatically packs the Vue.js products inside the final jar, however the frontend application can be tested isolatedly running `npm run serve` in order to take advantage of the npm autoreload functionalities.
By default http calls are mocked inside the Vue.js application.
In order to rely on real server calls edit the .env.development file in this way:
VUE_APP_API_CLIENT = 'server'
VUE_APP_API_BASE_URL = 'http://localhost:8081/gms/'
This assumes that your backend runs on 8081 port (with dev profile active, in order to enable the CORS policy) and the frontend runs on 8080 port.
First, do the login using the application running on the 8081 port, then you can access the frontend on the 8080.
ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/database/ 0000775 0000000 0000000 00000000000 13574416570 0021271 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/database/Dockerfile 0000664 0000000 0000000 00000000223 13574416570 0023260 0 ustar 00root root 0000000 0000000 FROM library/postgres:11
COPY gms/src/main/resources/sql/init.sql /docker-entrypoint-initdb.d/
COPY database/user.sql /docker-entrypoint-initdb.d/
ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/database/user.sql 0000664 0000000 0000000 00000000312 13574416570 0022764 0 ustar 00root root 0000000 0000000 CREATE ROLE gms WITH LOGIN PASSWORD 'gms';
GRANT USAGE ON SCHEMA public TO gms;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO gms;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO gms; ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/docker-env 0000664 0000000 0000000 00000000766 13574416570 0021516 0 ustar 00root root 0000000 0000000 SPRING_DATASOURCE_URL=jdbc:postgresql://140.105.79.115:5432/postgres
SECURITY_OAUTH2_CLIENT_ACCESS-TOKEN-URI=http://140.105.79.115/rap-ia2/auth/oauth2/token
SECURITY_OAUTH2_CLIENT_USER-AUTHORIZATION-URI=http://localhost/rap-ia2/auth/oauth2/authorize
SECURITY_OAUTH2_RESOURCE_TOKEN-INFO-URI=http://140.105.79.115/rap-ia2/auth/oauth2/check_token
SECURITY_OAUTH2_RESOURCE_JWK_KEY-SET-URI=http://140.105.79.115/rap-ia2/auth/oidc/jwks
RAP_WS-URL=http://140.105.79.115/rap-ia2/ws
SPRING_PROFILES_ACTIVE=prod
ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/ 0000775 0000000 0000000 00000000000 13574416570 0021567 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/ 0000775 0000000 0000000 00000000000 13574416570 0023122 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/.gitignore 0000664 0000000 0000000 00000000515 13574416570 0025113 0 ustar 00root root 0000000 0000000 HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/
ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/gms.properties 0000664 0000000 0000000 00000000232 13574416570 0026023 0 ustar 00root root 0000000 0000000 #base_url=http://localhost:8081/gms
#client_id=test
#client_secret=test
base_url=https://sso.ia2.inaf.it/gms
client_id=sso-admin
client_secret=cXjbauYe8g
ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/pom.xml 0000664 0000000 0000000 00000003131 13574416570 0024435 0 ustar 00root root 0000000 0000000
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.1.7.RELEASE
it.inaf.ia2
gms-cli
0.0.1-SNAPSHOT
gms-cli
GMS Command Line Client
1.8
org.springframework.boot
spring-boot-starter
org.springframework.boot
spring-boot-starter-test
test
${project.groupId}
gms-client-lib
1.0-SNAPSHOT
org.springframework.boot
spring-boot-maven-plugin
ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/ 0000775 0000000 0000000 00000000000 13574416570 0023711 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/main/ 0000775 0000000 0000000 00000000000 13574416570 0024635 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/main/java/ 0000775 0000000 0000000 00000000000 13574416570 0025556 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/main/java/it/ 0000775 0000000 0000000 00000000000 13574416570 0026172 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/main/java/it/inaf/ 0000775 0000000 0000000 00000000000 13574416570 0027107 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/main/java/it/inaf/ia2/ 0000775 0000000 0000000 00000000000 13574416570 0027562 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/main/java/it/inaf/ia2/gms/ 0000775 0000000 0000000 00000000000 13574416570 0030350 5 ustar 00root root 0000000 0000000 cli/ 0000775 0000000 0000000 00000000000 13574416570 0031040 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/main/java/it/inaf/ia2/gms CLI.java 0000664 0000000 0000000 00000010300 13574416570 0032304 0 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/main/java/it/inaf/ia2/gms/cli package it.inaf.ia2.gms.cli;
import it.inaf.ia2.gms.client.GmsClient;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
@Component
public class CLI implements CommandLineRunner {
private final GmsClient client;
public CLI() throws IOException {
File config = new File("gms.properties");
if (!config.exists()) {
System.err.println("Unable to find the file gms.properties");
System.exit(1);
}
Properties properties = new Properties();
try (InputStream in = new FileInputStream(config)) {
properties.load(in);
}
String baseUrl = (String) properties.get("base_url");
if (baseUrl == null) {
System.err.println("Missing base_url in gms.properties");
System.exit(1);
}
String clientId = (String) properties.get("client_id");
if (clientId == null) {
System.err.println("Missing client_id in gms.properties");
System.exit(1);
}
String clientSecret = (String) properties.get("client_secret");
if (clientSecret == null) {
System.err.println("Missing client_secret in gms.properties");
System.exit(1);
}
client = new GmsClient(baseUrl, clientId, clientSecret);
}
@Override
public void run(String... args) throws Exception {
if (args.length < 2) {
displayUsage();
}
switch (args[0]) {
case "create-group":
client.addGroup(getNames(args, 1));
System.out.println("Group created");
break;
case "delete-group":
client.removeGroup(getNames(args, 1));
System.out.println("Group deleted");
break;
case "add-member":
if (args.length < 3) {
displayUsage();
}
client.addMember(getNames(args, 1, args.length - 2), args[args.length - 1]);
System.out.println("Member added");
break;
case "remove-member":
if (args.length < 3) {
displayUsage();
}
client.removeMember(getNames(args, 1, args.length - 2), args[args.length - 1]);
System.out.println("Member removed");
break;
case "add-permission":
if (args.length < 4) {
displayUsage();
}
client.addPermission(getNames(args, 1, args.length - 3), args[args.length - 2], args[args.length - 1]);
System.out.println("Permission added");
break;
case "delete-permission":
if (args.length < 4) {
displayUsage();
}
client.removePermission(getNames(args, 1, args.length - 2), args[args.length - 1]);
System.out.println("Permission removed");
break;
default:
displayUsage();
break;
}
}
private void displayUsage() {
System.out.println("java -jar gms-client.jar\n"
+ " create-group \n"
+ " delete-group \n"
+ " add-member \n"
+ " remove-member \n"
+ " add-permission \n"
+ " delete-permission ");
System.exit(0);
}
private List getNames(String[] args, int startIndex) {
return getNames(args, startIndex, args.length - 1);
}
private List getNames(String[] args, int startIndex, int endIndex) {
List names = new ArrayList<>();
for (int i = startIndex; i <= endIndex; i++) {
names.add(args[i]);
}
return names;
}
}
GmsCliApplication.java 0000664 0000000 0000000 00000000470 13574416570 0035246 0 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/main/java/it/inaf/ia2/gms/cli package it.inaf.ia2.gms.cli;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class GmsCliApplication {
public static void main(String[] args) {
SpringApplication.run(GmsCliApplication.class, args);
}
}
ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/main/resources/ 0000775 0000000 0000000 00000000000 13574416570 0026647 5 ustar 00root root 0000000 0000000 application.properties 0000664 0000000 0000000 00000000062 13574416570 0033207 0 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/main/resources spring.main.banner-mode=off
logging.level.root=OFF ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/test/ 0000775 0000000 0000000 00000000000 13574416570 0024670 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/test/java/ 0000775 0000000 0000000 00000000000 13574416570 0025611 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/test/java/it/ 0000775 0000000 0000000 00000000000 13574416570 0026225 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/test/java/it/inaf/ 0000775 0000000 0000000 00000000000 13574416570 0027142 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/test/java/it/inaf/ia2/ 0000775 0000000 0000000 00000000000 13574416570 0027615 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/test/java/it/inaf/ia2/gms/ 0000775 0000000 0000000 00000000000 13574416570 0030403 5 ustar 00root root 0000000 0000000 cli/ 0000775 0000000 0000000 00000000000 13574416570 0031073 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/test/java/it/inaf/ia2/gms GmsCliApplicationTests.java 0000664 0000000 0000000 00000000520 13574416570 0036320 0 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-cli/src/test/java/it/inaf/ia2/gms/cli package it.inaf.ia2.gms.cli;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class GmsCliApplicationTests {
@Test
public void contextLoads() {
}
}
ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-client-lib/ 0000775 0000000 0000000 00000000000 13574416570 0024375 5 ustar 00root root 0000000 0000000 ia2-gms-ef9122a2c8730f6151cf11223d5eb20a294c8129/gms-client/gms-client-lib/pom.xml 0000664 0000000 0000000 00000003005 13574416570 0025710 0 ustar 00root root 0000000 0000000
4.0.0
it.inaf.ia2
gms-client-lib
1.0-SNAPSHOT
jar
UTF-8
1.8
1.8
5.1.8.RELEASE
org.springframework
spring-web
${spring.version}
com.fasterxml.jackson.core
jackson-databind
2.9.9
junit
junit
4.12
test
org.mockito
mockito-core
2.23.4
test