Skip to content

Commit

Permalink
Merge pull request #355 from peter-szrnka/354-gms-178-demo-for-spring…
Browse files Browse the repository at this point in the history
…-boot-client

GMS-178 demo for spring boot client
  • Loading branch information
peter-szrnka authored Dec 9, 2024
2 parents a00da66 + 098d8d3 commit 5485164
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client-samples/gms-client-sample-java-client-lib/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hu.szrnkapeter.gms</groupId>
<groupId>hu.peterszrnka.gms</groupId>
<artifactId>gms-client-sample-java-lib</artifactId>
<version>0.0.1-SNAPSHOT</version>

Expand Down
38 changes: 38 additions & 0 deletions client-samples/gms-client-sample-spring-client-lib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
42 changes: 42 additions & 0 deletions client-samples/gms-client-sample-spring-client-lib/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>hu.peterszrnka.gms</groupId>
<artifactId>gms-client-sample-spring-client-lib</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencyManagement>
<dependencies>
<!-- Spring Boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.3.5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>io.github.peter-szrnka</groupId>
<artifactId>give-my-secret-client-spring</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package io.github.gms.sample;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package io.github.gms.sample;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {

@Value("${config.test}")
private String test;

@Value("${config.username}")
private String test1;
@Value("${config.password}")
private String test2;

@Value("${config.other1}")
private String test3;

@Value("${config.other2}")
private String test4;

@GetMapping
public String test() {
return "Test value: " + test + "; Username: " + test1 + "; Password: " + test2 + ";" + test3 + ";" + test4;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
server.port=8081

# Examples of how to consume GMS API
config.test=giveMySecret(gms-config1.properties:value)
config.username=giveMySecret(src/main/resources/gms-config2.properties:username)
config.password=giveMySecret(src/main/resources/gms-config2.properties:password)
config.other1=giveMySecret(src/main/resources/gms-config2.properties:other1)
config.other2=giveMySecret(src/main/resources/gms-config2.properties:other2)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
giveMySecret.baseUrl=http://localhost:8080
giveMySecret.apiKey=tb14kogUFKD9FHDepKzkJXSNcV2b1jYu
giveMySecret.secretId=secret1
giveMySecret.decrypt=false
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
giveMySecret.baseUrl=http://localhost:8080
giveMySecret.apiKey=VNcsBIi6w0Oku3L2Q0JlJydn5LWw2I4p
giveMySecret.secretId=secret2
giveMySecret.keystore.file=src/main/resources/test.p12
giveMySecret.keystore.type=PKCS12
giveMySecret.keystore.credential=test
giveMySecret.keystore.alias=test
giveMySecret.keystore.aliasCredential=test
Binary file not shown.

0 comments on commit 5485164

Please sign in to comment.