VGS :: Spring Integration

Provides an easy way to integrate a Spring-based project with the VGS forward proxy.

License

License

Categories

Categories

Security
GroupId

GroupId

com.verygoodsecurity
ArtifactId

ArtifactId

vgs-proxy-spring
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

VGS :: Spring Integration
Provides an easy way to integrate a Spring-based project with the VGS forward proxy.
Project URL

Project URL

https://github.com/verygoodsecurity/vgs-proxy-spring
Source Code Management

Source Code Management

https://github.com/verygoodsecurity/vgs-proxy-spring

Download vgs-proxy-spring

How to add to project

<!-- https://jarcasting.com/artifacts/com.verygoodsecurity/vgs-proxy-spring/ -->
<dependency>
    <groupId>com.verygoodsecurity</groupId>
    <artifactId>vgs-proxy-spring</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.verygoodsecurity/vgs-proxy-spring/
implementation 'com.verygoodsecurity:vgs-proxy-spring:1.0.0'
// https://jarcasting.com/artifacts/com.verygoodsecurity/vgs-proxy-spring/
implementation ("com.verygoodsecurity:vgs-proxy-spring:1.0.0")
'com.verygoodsecurity:vgs-proxy-spring:jar:1.0.0'
<dependency org="com.verygoodsecurity" name="vgs-proxy-spring" rev="1.0.0">
  <artifact name="vgs-proxy-spring" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.verygoodsecurity', module='vgs-proxy-spring', version='1.0.0')
)
libraryDependencies += "com.verygoodsecurity" % "vgs-proxy-spring" % "1.0.0"
[com.verygoodsecurity/vgs-proxy-spring "1.0.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.springframework : spring-context jar
org.springframework : spring-web jar
org.apache.httpcomponents : httpclient jar

Project Modules

There are no modules declared in this project.

VGS Logo

vgs-proxy-spring
Provides an easy way to integrate a Spring-based project with the VGS forward proxy.

CircleCI

Quick Start

Installation

Before you begin, add this library as a dependency to your project.

For Maven:

<dependency>
    <groupId>com.verygoodsecurity</groupId>
    <artifactId>vgs-proxy-spring</artifactId>
    <version>1.0.0</version>
</dependency>

For Gradle:

compile 'com.verygoodsecurity:vgs-proxy-spring:1.0.0'

Usage

First of all, set the vgs.proxy.url property in the application context for the vault you want to integrate with. Look for the Outbound Route URL on the Integration tab within the dashboard and replace the placeholders with a pair of access credentials. The resulting URL should look similar to this one:

https://USvWJyqzunxnW1pDKxgvPLmf:3da78204-e566-4e03-a03a-d84e3d1d4d1b@tntabeiyol.SANDBOX.verygoodproxy.com:8080

Secondly, do the following steps to configure a RestTemplate to use the VGS forward proxy:

  • Declare a bean annotated with @VgsProxied
  • Annotate any configuration class with @EnableVgsProxy

Here's an example configuration you may end up with:

@Configuration
@EnableVgsProxy
public class AppConfig {

    @Bean
    @VgsProxied
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}

Of course, not every HTTP request should be proxied, so you may also have a RestTemplate that is not configured to use the proxy. Simply declare another bean and inject it as normal:

@Configuration
@EnableVgsProxy
public class AppConfig {

    @Bean
    @VgsProxied
    public RestTemplate vgsProxied() {
        return new RestTemplate();
    }

    @Bean
    @Primary
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}

However, you must use a qualifier to access the proxied RestTemplate then:

@Component
public class MySecureClient {

  private final RestTemplate restTemplate;
  private final RestTemplate vgsProxied;

  @Autowired
  public MySecureClient(RestTemplate restTemplate,
                        @VgsProxied RestTemplate vgsProxied) {

    this.restTemplate = restTemplate;
    this.vgsProxied = vgsProxied;
  }

  public void doRegularStuff() {
    return restTemplate.getForObject("https://httpbin.verygoodsecurity.io/get", String.class);
  }

  public void doSecureStuff(String json) {
    vgsProxied.postForObject("https://httpbin.verygoodsecurity.io/post", json, String.class);
  }
}

For a complete example, see the sample project.

What is VGS?

Want to just jump right in? Check out our getting started guide.

Very Good Security (VGS) allows you to enhance your security standing while maintaining the utility of your data internally and with third-parties. As an added benefit, we accelerate your compliance certification process and help you quickly obtain security-related compliances that stand between you and your market opportunities.

To learn more, visit us at https://www.verygoodsecurity.com/

License

This project is licensed under the MIT license. See the LICENSE file for details.

com.verygoodsecurity

Very Good Security, Inc.

Versions

Version
1.0.0