diff --git a/docs/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml similarity index 100% rename from docs/.github/workflows/deploy-docs.yml rename to .github/workflows/deploy-docs.yml diff --git a/.gitignore b/.gitignore index e155f0dc..fd3c8999 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,9 @@ release.properties .vscode/ plugins/ + +node +node_modules +build +package.json +package-lock.json diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index c3150437..b8e54d3a 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1 +1,2 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.0/apache-maven-3.9.0-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar diff --git a/README.adoc b/README.adoc index 813174ac..c431660a 100644 --- a/README.adoc +++ b/README.adoc @@ -7,13 +7,11 @@ Edit the files in the src/main/asciidoc/ directory instead. :docs: https://cloud.spring.io/spring-cloud-vault/spring-cloud-vault.html -Spring Cloud Vault Config provides client-side support for externalized configuration in a distributed system. -With https://www.vaultproject.io[HashiCorp's Vault] you have a central place to manage external secret properties for applications across all environments. -Vault can manage static and dynamic secrets such as username/password for remote applications/resources and provide credentials for external services such as MySQL, PostgreSQL, Apache Cassandra, Couchbase, MongoDB, Consul, AWS and more. +[[features]] += Features -== Features - -=== Spring Cloud Vault Config Client +[[spring-cloud-vault-config-client]] +== Spring Cloud Vault Config Client Specifically for Spring applications: @@ -37,9 +35,8 @@ Specifically for Spring applications: * Bootstrap application context: a parent context for the main application that can be trained to do anything. -== Quick Start - -:docs: https://cloud.spring.io/spring-cloud-vault/reference/html/ +[[quick-start]] += Quick Start *Prerequisites* @@ -167,13 +164,13 @@ where the "application" is injected as the `spring.application.name` in the `SpringApplication` (i.e. what is normally "application" in a regular Spring Boot app), "profile" is an active profile (or comma-separated list of properties). Properties retrieved from Vault will be used "as-is" without further prefixing of the property names. +[[client-side-usage]] == Client Side Usage To use these features in an application, just build it as a Spring Boot application that depends on `spring-cloud-vault-config` (e.g. see the test cases). Example Maven configuration: .pom.xml -==== [source,xml,indent=0,subs="verbatim,quotes,attributes"] ---- @@ -207,11 +204,9 @@ Example Maven configuration: ---- -==== Then you can create a standard Spring Boot application, like this simple HTTP server: -==== [source,java] ---- @SpringBootApplication @@ -228,13 +223,11 @@ public class Application { } } ---- -==== When it runs it will pick up the external configuration from the default local Vault server on port `8200` if it is running. To modify the startup behavior you can change the location of the Vault server using `application.properties`, for example .application.yml -==== [source,yaml] ---- spring.cloud.vault: @@ -247,7 +240,6 @@ spring.cloud.vault: config: spring.config.import: vault:// ---- -==== * `host` sets the hostname of the Vault host. The host name will be used for SSL certificate validation @@ -261,34 +253,33 @@ Supported schemes are `http` and `https`. Enabling further integrations requires additional dependencies and configuration. Depending on how you have set up Vault you might need additional configuration like -{docs}#vault.config.ssl[SSL] and -{docs}#vault.config.authentication[authentication]. +xref:other-topics.adoc#vault.config.ssl[SSL] and +xref:authentication.adoc#vault.config.authentication[authentication]. If the application imports the `spring-boot-starter-actuator` project, the status of the vault server will be available via the `/health` endpoint. The vault health indicator can be enabled or disabled through the property `management.health.vault.enabled` (default to `true`). NOTE: With Spring Cloud Vault 3.0 and Spring Boot 2.4, the bootstrap context initialization (`bootstrap.yml`, `bootstrap.properties`) of property sources was deprecated. -Instead, Spring Cloud Vault favors Spring Boot's Config Data API which allows importing configuration from Vault. With Spring Boot Config Data approach, you need to set the `spring.config.import` property in order to bind to Vault. You can read more about it in the <>. +Instead, Spring Cloud Vault favors Spring Boot's Config Data API which allows importing configuration from Vault. With Spring Boot Config Data approach, you need to set the `spring.config.import` property in order to bind to Vault. You can read more about it in the xref:config-data.adoc#vault.configdata.locations[Config Data Locations section]. You can enable the bootstrap context either by setting the configuration property `spring.cloud.bootstrap.enabled=true` or by including the dependency `org.springframework.cloud:spring-cloud-starter-bootstrap`. -=== Authentication +[[authentication]] +== Authentication Vault requires an https://www.vaultproject.io/docs/concepts/auth.html[authentication mechanism] to https://www.vaultproject.io/docs/concepts/tokens.html[authorize client requests]. -Spring Cloud Vault supports multiple {docs}#vault.config.authentication[authentication mechanisms] to authenticate applications with Vault. +Spring Cloud Vault supports multiple xref:authentication.adoc#vault.config.authentication[authentication mechanisms] to authenticate applications with Vault. -For a quickstart, use the root token printed by the <>. +For a quickstart, use the root token printed by the xref:quickstart.adoc#quickstart.vault.start[Vault initialization]. .application.yml -==== [source,yaml] ---- spring.cloud.vault: token: 19aefa97-cccc-bbbb-aaaa-225940e63d76 spring.config.import: vault:// ---- -==== WARNING: Consider carefully your security requirements. Static token authentication is fine if you want quickly get started with Vault, but a static token is not protected any further. @@ -297,9 +288,11 @@ Any disclosure to unintended parties allows Vault use with the associated token -== Building +[[building]] += Building -=== Build requirements for Vault +[[build-requirements-for-vault]] +== Build requirements for Vault Spring Cloud Vault Config requires SSL certificates and a running Vault instance listening on `localhost:8200`. Certificates and the Vault setup are scripted, the scripts are located in `src/test/bash`. @@ -327,315 +320,12 @@ $ ./docs/src/main/ruby/generate_readme.sh > README.adoc This script requires ruby and the asciidoctor gem installed (`gem install asciidoctor`) -:jdkversion: 17 +[[building]] += Building -=== Basic Compile and Test +Unresolved directive in https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/pages/building.adoc - include::partial$building.adoc[] -To build the source you will need to install JDK {jdkversion}. - -Spring Cloud uses Maven for most build-related activities, and you -should be able to get off the ground quite quickly by cloning the -project you are interested in and typing - ----- -$ ./mvnw install ----- - -NOTE: You can also install Maven (>=3.3.3) yourself and run the `mvn` command -in place of `./mvnw` in the examples below. If you do that you also -might need to add `-P spring` if your local Maven settings do not -contain repository declarations for spring pre-release artifacts. - -NOTE: Be aware that you might need to increase the amount of memory -available to Maven by setting a `MAVEN_OPTS` environment variable with -a value like `-Xmx512m -XX:MaxPermSize=128m`. We try to cover this in -the `.mvn` configuration, so if you find you have to do it to make a -build succeed, please raise a ticket to get the settings added to -source control. - -The projects that require middleware (i.e. Redis) for testing generally -require that a local instance of [Docker](https://www.docker.com/get-started) is installed and running. - - -=== Documentation - -The spring-cloud-build module has a "docs" profile, and if you switch -that on it will try to build asciidoc sources from -`src/main/asciidoc`. As part of that process it will look for a -`README.adoc` and process it by loading all the includes, but not -parsing or rendering it, just copying it to `${main.basedir}` -(defaults to `${basedir}`, i.e. the root of the project). If there are -any changes in the README it will then show up after a Maven build as -a modified file in the correct place. Just commit it and push the change. - -=== Working with the code -If you don't have an IDE preference we would recommend that you use -https://www.springsource.com/developer/sts[Spring Tools Suite] or -https://eclipse.org[Eclipse] when working with the code. We use the -https://eclipse.org/m2e/[m2eclipse] eclipse plugin for maven support. Other IDEs and tools -should also work without issue as long as they use Maven 3.3.3 or better. - -==== Activate the Spring Maven profile -Spring Cloud projects require the 'spring' Maven profile to be activated to resolve -the spring milestone and snapshot repositories. Use your preferred IDE to set this -profile to be active, or you may experience build errors. - -==== Importing into eclipse with m2eclipse -We recommend the https://eclipse.org/m2e/[m2eclipse] eclipse plugin when working with -eclipse. If you don't already have m2eclipse installed it is available from the "eclipse -marketplace". - -NOTE: Older versions of m2e do not support Maven 3.3, so once the -projects are imported into Eclipse you will also need to tell -m2eclipse to use the right profile for the projects. If you -see many different errors related to the POMs in the projects, check -that you have an up to date installation. If you can't upgrade m2e, -add the "spring" profile to your `settings.xml`. Alternatively you can -copy the repository settings from the "spring" profile of the parent -pom into your `settings.xml`. - -==== Importing into eclipse without m2eclipse -If you prefer not to use m2eclipse you can generate eclipse project metadata using the -following command: - -[indent=0] ----- - $ ./mvnw eclipse:eclipse ----- - -The generated eclipse projects can be imported by selecting `import existing projects` -from the `file` menu. - - -== Contributing - -:spring-cloud-build-branch: master - -Spring Cloud is released under the non-restrictive Apache 2.0 license, -and follows a very standard Github development process, using Github -tracker for issues and merging pull requests into master. If you want -to contribute even something trivial please do not hesitate, but -follow the guidelines below. - -=== Sign the Contributor License Agreement -Before we accept a non-trivial patch or pull request we will need you to sign the -https://cla.pivotal.io/sign/spring[Contributor License Agreement]. -Signing the contributor's agreement does not grant anyone commit rights to the main -repository, but it does mean that we can accept your contributions, and you will get an -author credit if we do. Active contributors might be asked to join the core team, and -given the ability to merge pull requests. - -=== Code of Conduct -This project adheres to the Contributor Covenant https://github.com/spring-cloud/spring-cloud-build/blob/master/docs/src/main/asciidoc/code-of-conduct.adoc[code of -conduct]. By participating, you are expected to uphold this code. Please report -unacceptable behavior to spring-code-of-conduct@pivotal.io. - -=== Code Conventions and Housekeeping -None of these is essential for a pull request, but they will all help. They can also be -added after the original pull request but before a merge. - -* Use the Spring Framework code format conventions. If you use Eclipse - you can import formatter settings using the - `eclipse-code-formatter.xml` file from the - https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-dependencies-parent/eclipse-code-formatter.xml[Spring - Cloud Build] project. If using IntelliJ, you can use the - https://plugins.jetbrains.com/plugin/6546[Eclipse Code Formatter - Plugin] to import the same file. -* Make sure all new `.java` files to have a simple Javadoc class comment with at least an - `@author` tag identifying you, and preferably at least a paragraph on what the class is - for. -* Add the ASF license header comment to all new `.java` files (copy from existing files - in the project) -* Add yourself as an `@author` to the .java files that you modify substantially (more - than cosmetic changes). -* Add some Javadocs and, if you change the namespace, some XSD doc elements. -* A few unit tests would help a lot as well -- someone has to do it. -* If no-one else is using your branch, please rebase it against the current master (or - other target branch in the main project). -* When writing a commit message please follow https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[these conventions], - if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit - message (where XXXX is the issue number). - -=== Checkstyle - -Spring Cloud Build comes with a set of checkstyle rules. You can find them in the `spring-cloud-build-tools` module. The most notable files under the module are: - -.spring-cloud-build-tools/ ----- -└── src -    ├── checkstyle -    │   └── checkstyle-suppressions.xml <3> -    └── main -    └── resources -    ├── checkstyle-header.txt <2> -    └── checkstyle.xml <1> ----- -<1> Default Checkstyle rules -<2> File header setup -<3> Default suppression rules - -==== Checkstyle configuration - -Checkstyle rules are *disabled by default*. To add checkstyle to your project just define the following properties and plugins. - -.pom.xml ----- - -true <1> - true - <2> - true - <3> - - - - - <4> - io.spring.javaformat - spring-javaformat-maven-plugin - - <5> - org.apache.maven.plugins - maven-checkstyle-plugin - - - - - - <5> - org.apache.maven.plugins - maven-checkstyle-plugin - - - - ----- -<1> Fails the build upon Checkstyle errors -<2> Fails the build upon Checkstyle violations -<3> Checkstyle analyzes also the test sources -<4> Add the Spring Java Format plugin that will reformat your code to pass most of the Checkstyle formatting rules -<5> Add checkstyle plugin to your build and reporting phases - -If you need to suppress some rules (e.g. line length needs to be longer), then it's enough for you to define a file under `${project.root}/src/checkstyle/checkstyle-suppressions.xml` with your suppressions. Example: - -.projectRoot/src/checkstyle/checkstyle-suppresions.xml ----- - - - - - - ----- - -It's advisable to copy the `${spring-cloud-build.rootFolder}/.editorconfig` and `${spring-cloud-build.rootFolder}/.springformat` to your project. That way, some default formatting rules will be applied. You can do so by running this script: - -```bash -$ curl https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/.editorconfig -o .editorconfig -$ touch .springformat -``` - -=== IDE setup - -==== Intellij IDEA - -In order to setup Intellij you should import our coding conventions, inspection profiles and set up the checkstyle plugin. -The following files can be found in the https://github.com/spring-cloud/spring-cloud-build/tree/master/spring-cloud-build-tools[Spring Cloud Build] project. - -.spring-cloud-build-tools/ ----- -└── src -    ├── checkstyle -    │   └── checkstyle-suppressions.xml <3> -    └── main -    └── resources -    ├── checkstyle-header.txt <2> -    ├── checkstyle.xml <1> -    └── intellij -       ├── Intellij_Project_Defaults.xml <4> -       └── Intellij_Spring_Boot_Java_Conventions.xml <5> ----- -<1> Default Checkstyle rules -<2> File header setup -<3> Default suppression rules -<4> Project defaults for Intellij that apply most of Checkstyle rules -<5> Project style conventions for Intellij that apply most of Checkstyle rules - -.Code style - -image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/{spring-cloud-build-branch}/docs/src/main/asciidoc/images/intellij-code-style.png[Code style] - -Go to `File` -> `Settings` -> `Editor` -> `Code style`. There click on the icon next to the `Scheme` section. There, click on the `Import Scheme` value and pick the `Intellij IDEA code style XML` option. Import the `spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml` file. - -.Inspection profiles - -image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/{spring-cloud-build-branch}/docs/src/main/asciidoc/images/intellij-inspections.png[Code style] - -Go to `File` -> `Settings` -> `Editor` -> `Inspections`. There click on the icon next to the `Profile` section. There, click on the `Import Profile` and import the `spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml` file. - -.Checkstyle - -To have Intellij work with Checkstyle, you have to install the `Checkstyle` plugin. It's advisable to also install the `Assertions2Assertj` to automatically convert the JUnit assertions - -image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/{spring-cloud-build-branch}/docs/src/main/asciidoc/images/intellij-checkstyle.png[Checkstyle] - -Go to `File` -> `Settings` -> `Other settings` -> `Checkstyle`. There click on the `+` icon in the `Configuration file` section. There, you'll have to define where the checkstyle rules should be picked from. In the image above, we've picked the rules from the cloned Spring Cloud Build repository. However, you can point to the Spring Cloud Build's GitHub repository (e.g. for the `checkstyle.xml` : `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle.xml`). We need to provide the following variables: - -- `checkstyle.header.file` - please point it to the Spring Cloud Build's, `spring-cloud-build-tools/src/main/resources/checkstyle-header.txt` file either in your cloned repo or via the `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt` URL. -- `checkstyle.suppressions.file` - default suppressions. Please point it to the Spring Cloud Build's, `spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml` file either in your cloned repo or via the `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml` URL. -- `checkstyle.additional.suppressions.file` - this variable corresponds to suppressions in your local project. E.g. you're working on `spring-cloud-contract`. Then point to the `project-root/src/checkstyle/checkstyle-suppressions.xml` folder. Example for `spring-cloud-contract` would be: `/home/username/spring-cloud-contract/src/checkstyle/checkstyle-suppressions.xml`. - -IMPORTANT: Remember to set the `Scan Scope` to `All sources` since we apply checkstyle rules for production and test sources. - -=== Duplicate Finder - -Spring Cloud Build brings along the `basepom:duplicate-finder-maven-plugin`, that enables flagging duplicate and conflicting classes and resources on the java classpath. - -==== Duplicate Finder configuration - -Duplicate finder is *enabled by default* and will run in the `verify` phase of your Maven build, but it will only take effect in your project if you add the `duplicate-finder-maven-plugin` to the `build` section of the projecst's `pom.xml`. - -.pom.xml -[source,xml] ----- - - - - org.basepom.maven - duplicate-finder-maven-plugin - - - ----- - -For other properties, we have set defaults as listed in the https://github.com/basepom/duplicate-finder-maven-plugin/wiki[plugin documentation]. - -You can easily override them but setting the value of the selected property prefixed with `duplicate-finder-maven-plugin`. For example, set `duplicate-finder-maven-plugin.skip` to `true` in order to skip duplicates check in your build. - -If you need to add `ignoredClassPatterns` or `ignoredResourcePatterns` to your setup, make sure to add them in the plugin configuration section of your project: - -[source,xml] ----- - - - - org.basepom.maven - duplicate-finder-maven-plugin - - - org.joda.time.base.BaseDateTime - .*module-info - - - changelog.txt - - - - - - - ----- +[[contributing]] += Contributing +Unresolved directive in - include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing.adoc[] diff --git a/docs/antora-playbook.yml b/docs/antora-playbook.yml index 9a70e676..3b24582a 100644 --- a/docs/antora-playbook.yml +++ b/docs/antora-playbook.yml @@ -6,15 +6,11 @@ antora: - '@antora/collector-extension' - '@antora/atlas-extension' - require: '@springio/antora-extensions/root-component-extension' - root_component_name: 'PROJECT_WITHOUT_SPRING' - # FIXME: Run antora once using this extension to migrate to the Asciidoc Tabs syntax - # and then remove this extension - - require: '@springio/antora-extensions/tabs-migration-extension' - unwrap_example_block: always - save_result: true + root_component_name: 'cloud-vault' + site: - title: PROJECT_FULL_NAME - url: https://docs.spring.io/PROJECT_NAME/reference/ + title: Spring Cloud Vault + url: https://docs.spring.io/spring-cloud-vault/reference/ content: sources: - url: ./.. diff --git a/docs/antora.yml b/docs/antora.yml index 15b346da..5cb6f868 100644 --- a/docs/antora.yml +++ b/docs/antora.yml @@ -1,6 +1,6 @@ -name: PROJECT_WITHOUT_SPRING +name: cloud-vault version: true -title: PROJECT_NAME +title: Spring Cloud Vault nav: - modules/ROOT/nav.adoc ext: diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index 4c1d92a4..cd40339d 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -1,6 +1,4 @@ -* xref:index.adoc[] -* xref:intro.adoc[] -* xref:_attributes.adoc[] +* xref:index.adoc[Introduction] * xref:new-features.adoc[] * xref:quickstart.adoc[] * xref:config-data.adoc[] @@ -8,6 +6,3 @@ * xref:secret-backends.adoc[] * xref:other-topics.adoc[] * xref:appendix.adoc[] -* xref:_configprops.adoc[] -* xref:README.adoc[] -* xref:spring-cloud-vault.adoc[] diff --git a/docs/modules/ROOT/pages/_attributes.adoc b/docs/modules/ROOT/pages/_attributes.adoc index 731e8d7c..23877393 100644 --- a/docs/modules/ROOT/pages/_attributes.adoc +++ b/docs/modules/ROOT/pages/_attributes.adoc @@ -11,3 +11,8 @@ :sc-ext: java :project-full-name: Spring Cloud Vault + +:github: https://github.com/spring-cloud/spring-cloud-vault +:githubmaster: {github}/tree/main +:revnumber: {project-version} +:docslink: {githubmaster}/docs/src/main/asciidoc \ No newline at end of file diff --git a/docs/modules/ROOT/pages/appendix.adoc b/docs/modules/ROOT/pages/appendix.adoc index eef1c905..24352004 100644 --- a/docs/modules/ROOT/pages/appendix.adoc +++ b/docs/modules/ROOT/pages/appendix.adoc @@ -1,9 +1,11 @@ :numbered!: + [appendix] [[common-application-properties]] = Common application properties :page-section-summary-toc: 1 +include::_attributes.adoc[] Various properties can be specified inside your `application.properties` file, inside your `application.yml` file, or as command line switches. This appendix provides a list of common {project-full-name} properties and references to the underlying classes that consume them. @@ -11,3 +13,4 @@ This appendix provides a list of common {project-full-name} properties and refer NOTE: Property contributions can come from additional jar files on your classpath, so you should not consider this an exhaustive list. Also, you can define your own properties. +include::partial$_configprops.adoc[] \ No newline at end of file diff --git a/docs/modules/ROOT/pages/authentication.adoc b/docs/modules/ROOT/pages/authentication.adoc index e6bb7e6d..9e4fd3dc 100644 --- a/docs/modules/ROOT/pages/authentication.adoc +++ b/docs/modules/ROOT/pages/authentication.adoc @@ -16,14 +16,12 @@ NOTE: Token authentication is the default authentication method. If a token is disclosed an unintended party gains access to Vault and can access secrets for the intended client. .application.yml -==== [source,yaml] ---- spring.cloud.vault: authentication: TOKEN token: 00000000-0000-0000-0000-000000000000 ---- -==== * `authentication` setting this value to `TOKEN` selects the Token authentication method * `token` sets the static token to use. If missing or empty, then an attempt will be made to retrieve a token from ~/.vault-token. @@ -45,13 +43,11 @@ Spring Vault can send requests without the Disable Spring Vault's authentication infrastructure to disable client authentication and session management. .application.yml -==== [source,yaml] ---- spring.cloud.vault: authentication: NONE ---- -==== * `authentication` setting this value to `NONE` disables `ClientAuthentication` and `SessionManager`. @@ -72,7 +68,6 @@ The IP and Mac address are represented as Hex-encoded SHA256 hash. IP address-based UserId's use the local host's IP address. .application.yml using SHA256 IP-Address UserId's -==== [source,yaml] ---- spring.cloud.vault: @@ -80,7 +75,6 @@ spring.cloud.vault: app-id: user-id: IP_ADDRESS ---- -==== * `authentication` setting this value to `APPID` selects the AppId authentication method * `app-id-path` sets the path of the AppId mount to use @@ -102,7 +96,6 @@ The value of `network-interface` is optional and can be either an interface name or interface index (0-based). .application.yml using SHA256 Mac-Address UserId's -==== [source,yaml] ---- spring.cloud.vault: @@ -111,7 +104,6 @@ spring.cloud.vault: user-id: MAC_ADDRESS network-interface: eth0 ---- -==== * `network-interface` sets network interface to obtain the physical address @@ -137,7 +129,6 @@ This class must be on your classpath and must implement the `org.springframework Spring Cloud Vault will obtain the UserId by calling `createUserId` each time it authenticates using AppId to obtain a token. .application.yml -==== [source,yaml] ---- spring.cloud.vault: @@ -145,10 +136,8 @@ spring.cloud.vault: app-id: user-id: com.examlple.MyUserIdMechanism ---- -==== .MyUserIdMechanism.java -==== [source,yaml] ---- public class MyUserIdMechanism implements AppIdUserIdMechanism { @@ -160,7 +149,6 @@ public class MyUserIdMechanism implements AppIdUserIdMechanism { } } ---- -==== See also: https://www.vaultproject.io/docs/auth/app-id.html[Vault Documentation: Using the App ID auth backend] @@ -175,7 +163,6 @@ Spring Vault supports various AppRole scenarios (push/pull mode and wrapped). RoleId and optionally SecretId must be provided by configuration, Spring Vault will not look up these or create a custom SecretId. .application.yml with AppRole authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -183,7 +170,6 @@ spring.cloud.vault: app-role: role-id: bde2076b-cccb-3cf0-d57e-bca7b1e83a52 ---- -==== The following scenarios are supported along the required configuration details: @@ -225,7 +211,6 @@ Full pull mode is not yet supported. Using Spring Cloud Vault with the Spring WebFlux stack enables Vault's reactive auto-configuration which can be disabled by setting `spring.cloud.vault.reactive.enabled=false`. .application.yml with all AppRole authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -236,7 +221,6 @@ spring.cloud.vault: role: my-role app-role-path: approle ---- -==== * `role-id` sets the RoleId. * `secret-id` sets the SecretId. @@ -255,13 +239,11 @@ Unlike most Vault authentication backends, this backend does not require first-d Instead, it treats AWS as a Trusted Third Party and uses the cryptographically signed dynamic metadata information that uniquely represents each EC2 instance. .application.yml using AWS-EC2 Authentication -==== [source,yaml] ---- spring.cloud.vault: authentication: AWS_EC2 ---- -==== AWS-EC2 authentication enables nonce by default to follow the Trust On First Use (TOFU) principle. Any unintended party that gains access to the PKCS#7 identity metadata can authenticate against Vault. @@ -278,7 +260,6 @@ You can configure the authentication role by setting the `spring.cloud.vault.aws-ec2.role` property. .application.yml with configured role -==== [source,yaml] ---- spring.cloud.vault: @@ -286,10 +267,8 @@ spring.cloud.vault: aws-ec2: role: application-server ---- -==== .application.yml with all AWS EC2 authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -300,7 +279,6 @@ spring.cloud.vault: identity-document: http://... nonce: my-static-nonce ---- -==== * `authentication` setting this value to `AWS_EC2` selects the AWS EC2 authentication method * `role` sets the name of the role against which the login is being attempted. @@ -326,16 +304,13 @@ When using the AWS-IAM authentication you must create a role in Vault and assign An empty `role` defaults to the friendly name the current IAM role. .application.yml with required AWS-IAM Authentication properties -==== [source,yaml] ---- spring.cloud.vault: authentication: AWS_IAM ---- -==== .application.yml with all AWS-IAM Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -347,7 +322,6 @@ spring.cloud.vault: server-name: some.server.name endpoint-uri: https://sts.eu-central-1.amazonaws.com ---- -==== * `region` sets the name of the AWS region. If not supplied, the region will be determined by AWS defaults. * `role` sets the name of the role against which the login is being attempted. @@ -370,7 +344,6 @@ Unlike most Vault authentication backends, this backend does not require first-d Instead, it treats Azure as a Trusted Third Party and uses the managed service identity and instance metadata information that can be bound to a VM instance. .application.yml with required Azure Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -378,10 +351,8 @@ spring.cloud.vault: azure-msi: role: my-dev-role ---- -==== .application.yml with all Azure Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -392,7 +363,6 @@ spring.cloud.vault: metadata-service: http://169.254.169.254/metadata/instance… identity-token-service: http://169.254.169.254/metadata/identity… ---- -==== * `role` sets the name of the role against which the login is being attempted. * `azure-path` sets the path of the Azure mount to use @@ -420,7 +390,6 @@ To enable `cert` authentication you need to: 3. Set the `spring.cloud.vault.authentication` to `CERT` .application.yml -==== [source,yaml] ---- spring.cloud.vault: @@ -431,7 +400,6 @@ spring.cloud.vault: key-store-type: JKS cert-auth-path: cert ---- -==== See also: https://www.vaultproject.io/docs/auth/cert.html[Vault Documentation: Using the Cert auth backend] @@ -449,7 +417,6 @@ The login token will be retrieved from a wrapped response stored at `/cubbyhole/ NOTE: Response Wrapping for token creation requires Vault 0.6.0 or higher. .Creating and storing tokens -==== [source,shell] ---- $ vault token-create -wrap-ttl="10m" @@ -460,17 +427,14 @@ wrapping_token_ttl: 0h10m0s wrapping_token_creation_time: 2016-09-18 20:29:48.652957077 +0200 CEST wrapped_accessor: 46b6aebb-187f-932a-26d7-4f3d86a68319 ---- -==== .application.yml -==== [source,yaml] ---- spring.cloud.vault: authentication: CUBBYHOLE token: 397ccb93-ff6c-b17b-9389-380b01ca2645 ---- -==== See also: @@ -492,7 +456,6 @@ Unlike most Vault authentication backends, this backend does not require first-d Instead, it treats GCP as a Trusted Third Party and uses the cryptographically signed dynamic metadata information that uniquely represents each GCP service account. .application.yml with required GCP-GCE Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -500,10 +463,8 @@ spring.cloud.vault: gcp-gce: role: my-dev-role ---- -==== .application.yml with all GCP-GCE Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -513,7 +474,6 @@ spring.cloud.vault: role: my-dev-role service-account: my-service@projectid.iam.gserviceaccount.com ---- -==== * `role` sets the name of the role against which the login is being attempted. * `gcp-path` sets the path of the GCP mount to use @@ -540,7 +500,6 @@ environment variable, the Google Compute metadata service, or supplied externall JSON is the preferred form as it carries the project id and service account identifier required for calling ``projects.serviceAccounts.signJwt``. .application.yml with required GCP-IAM Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -548,10 +507,8 @@ spring.cloud.vault: gcp-iam: role: my-dev-role ---- -==== .application.yml with all GCP-IAM Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -566,7 +523,6 @@ spring.cloud.vault: role: my-dev-role service-account-id: my-service@projectid.iam.gserviceaccount.com ---- -==== * `role` sets the name of the role against which the login is being attempted. * `credentials.location` path to the credentials resource that contains Google credentials in JSON format. @@ -599,7 +555,6 @@ The authentication is role based and the role is bound to a service account name A file containing a JWT token for a pod’s service account is automatically mounted at `/var/run/secrets/kubernetes.io/serviceaccount/token`. .application.yml with all Kubernetes authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -609,7 +564,6 @@ spring.cloud.vault: kubernetes-path: kubernetes service-account-token-file: /var/run/secrets/kubernetes.io/serviceaccount/token ---- -==== * `role` sets the Role. * `kubernetes-path` sets the path of the Kubernetes mount to use. @@ -630,7 +584,6 @@ Unlike most Vault authentication backends, this backend does not require first-d Instead, it treats PCF as a Trusted Third Party and uses the managed instance identity. .application.yml with required PCF Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -638,10 +591,8 @@ spring.cloud.vault: pcf: role: my-dev-role ---- -==== .application.yml with all PCF Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -652,21 +603,20 @@ spring.cloud.vault: instance-certificate: /etc/cf-instance-credentials/instance.crt instance-key: /etc/cf-instance-credentials/instance.key ---- -==== * `role` sets the name of the role against which the login is being attempted. * `pcf-path` sets the path of the PCF mount to use. * `instance-certificate` sets the path to the PCF instance identity certificate. -Defaults to `${CF_INSTANCE_CERT}` env variable. +Defaults to `$\{CF_INSTANCE_CERT}` env variable. * `instance-key` sets the path to the PCF instance identity key. -Defaults to `${CF_INSTANCE_KEY}` env variable. +Defaults to `$\{CF_INSTANCE_KEY}` env variable. NOTE: PCF authentication requires BouncyCastle (bcpkix-jdk15on) to be on the classpath for RSA PSS signing. See also: https://www.vaultproject.io/docs/auth/pcf.html[Vault Documentation: Using the pcf auth backend] [[vault.config.acl]] -= ACL Requirements +== ACL Requirements This section explains which paths are accessed by Spring Vault so you can derive your policy declarations from the required capabilities. diff --git a/docs/modules/ROOT/pages/config-data.adoc b/docs/modules/ROOT/pages/config-data.adoc index 49c0fdff..f094f9df 100644 --- a/docs/modules/ROOT/pages/config-data.adoc +++ b/docs/modules/ROOT/pages/config-data.adoc @@ -21,7 +21,7 @@ Spring Cloud Vault supports two config locations: Using the default location mounts property sources for all enabled xref:secret-backends.adoc[Secret Backends]. Without further configuration, Spring Cloud Vault mounts the key-value backend at `/secret/${spring.application.name}`. -Each activated profile adds another context path following the form `/secret/${spring.application.name}/${profile}`. +Each activated profile adds another context path following the form `/secret/$\{spring.application.name}/$\{profile}`. Adding further modules to the classpath, such as `spring-cloud-config-databases`, provides additional secret backend configuration options which get mounted as property sources if enabled. If you want to control which context paths are mounted from Vault as `PropertySource`, you can either use a contextual location (`vault:///my/context/path`) or configure a xref:secret-backends.adoc#vault.config.backends.configurer[`VaultConfigurer`]. @@ -32,12 +32,10 @@ You can mix the default locations with contextual locations (or other config sys This approach is useful in particular if you want to disable the default key-value path computation and mount each key-value backend yourself instead. .application.yml -==== [source,yaml] ---- spring.config.import: vault://first/context/path, vault://other/path, vault:// ---- -==== Property names within a Spring `Environment` must be unique to avoid shadowing. If you use the same secret names in different context paths and you want to expose these as individual properties you can distinguish them by adding a `prefix` query parameter to the location. @@ -77,7 +75,6 @@ Spring Boot bootstraps the application before a Spring Context is available. The You can customize the infrastructure used by Spring Cloud Vault by registering custom instances using the `Bootstrapper` API: .Customizing `ClientHttpRequestFactory` -==== [source,java] ---- ClientOptions options = new ClientOptions(); @@ -90,10 +87,8 @@ new ClientFactoryWrapper(new HttpComponentsClientHttpRequestFactory(builder.buil SpringApplication application = new SpringApplication(MyApplication.class); application.addBootstrapRegistryInitializer(registry -> registry.register(ClientFactoryWrapper.class, supplier)); ---- -==== .Customizing `RestTemplateBuilder` -==== [source,java] ---- InstanceSupplier supplier = context -> { @@ -107,6 +102,5 @@ InstanceSupplier supplier = context -> { SpringApplication application = new SpringApplication(MyApplication.class); application.addBootstrapRegistryInitializer(registry -> registry.register(RestTemplateBuilder.class, supplier)); ---- -==== See also xref:secret-backends.adoc#vault.config.backends.configurer[Customize which secret backends to expose as PropertySource] and the source of `VaultConfigDataLoader` for customization hooks. diff --git a/docs/modules/ROOT/pages/configprops.adoc b/docs/modules/ROOT/pages/configprops.adoc new file mode 100644 index 00000000..32cbb8e5 --- /dev/null +++ b/docs/modules/ROOT/pages/configprops.adoc @@ -0,0 +1,6 @@ +[[configuration-properties]] += Configuration Properties + +Below you can find a list of configuration properties. + +include::partial$_configprops.adoc[] diff --git a/docs/modules/ROOT/pages/other-topics.adoc b/docs/modules/ROOT/pages/other-topics.adoc index 805e8df6..840861c6 100644 --- a/docs/modules/ROOT/pages/other-topics.adoc +++ b/docs/modules/ROOT/pages/other-topics.adoc @@ -12,32 +12,28 @@ Some additional properties of the service may need to be configured in its servi Service registries that do not provide details about transport layer security need to provide a `scheme` metadata entry to be set either to `https` or `http`. If no scheme is configured and the service is not exposed as secure service, then configuration defaults to `spring.cloud.vault.scheme` which is `https` when it's not set. -==== [source,yaml] ---- spring.cloud.vault.discovery: enabled: true service-id: my-vault-service ---- -==== [[vault.config.fail-fast]] -= Vault Client Fail Fast +== Vault Client Fail Fast In some cases, it may be desirable to fail startup of a service if it cannot connect to the Vault Server. If this is the desired behavior, set the bootstrap configuration property `spring.cloud.vault.fail-fast=true` and the client will halt with an Exception. -==== [source,yaml] ---- spring.cloud.vault: fail-fast: true ---- -==== [[vault.config.namespaces]] -= Vault Enterprise Namespace Support +== Vault Enterprise Namespace Support Vault Enterprise allows using namespaces to isolate multiple Vaults on a single Vault server. Configuring a namespace by setting @@ -47,24 +43,21 @@ Configuring a namespace by setting Please note that this feature is not supported by Vault Community edition and has no effect on Vault operations. -==== [source,yaml] ---- spring.cloud.vault: namespace: my-namespace ---- -==== See also: https://www.vaultproject.io/docs/enterprise/namespaces/index.html[Vault Enterprise: Namespaces] [[vault.config.ssl]] -= Vault Client SSL configuration +== Vault Client SSL configuration SSL can be configured declaratively by setting various properties. You can set either `javax.net.ssl.trustStore` to configure JVM-wide SSL settings or `spring.cloud.vault.ssl.trust-store` to set SSL settings only for Spring Cloud Vault Config. -==== [source,yaml] ---- spring.cloud.vault: @@ -75,7 +68,6 @@ spring.cloud.vault: enabled-protocols: TLSv1.2,TLSv1.3 enabled-cipher-suites: TLS_AES_128_GCM_SHA256 ---- -==== * `trust-store` sets the resource for the trust-store. SSL-secured Vault communication will validate the Vault SSL certificate with the specified trust-store. @@ -87,7 +79,7 @@ SSL-secured Vault communication will validate the Vault SSL certificate with the Please note that configuring `spring.cloud.vault.ssl.*` can be only applied when either Apache Http Components or the OkHttp client is on your class-path. [[vault-lease-renewal]] -= Lease lifecycle management (renewal and revocation) +== Lease lifecycle management (renewal and revocation) With every secret, Vault creates a lease: metadata containing information such as a time duration, renewability, and more. @@ -107,7 +99,6 @@ Lease renewal and revocation is enabled by default and can be disabled by settin to `false`. This is not recommended as leases can expire and Spring Cloud Vault cannot longer access Vault or services using generated credentials and valid credentials remain active after application shutdown. -==== [source,yaml] ---- spring.cloud.vault: @@ -118,7 +109,6 @@ spring.cloud.vault: lease-endpoints: Legacy ---- -==== * `enabled` controls whether leases associated with secrets are considered to be renewed and expired secrets are rotated. Enabled by default. @@ -132,7 +122,7 @@ Legacy for vault versions before 0.8 and SysLeases for later. See also: https://www.vaultproject.io/docs/concepts/lease.html[Vault Documentation: Lease, Renew, and Revoke] [[vault-session-lifecycle]] -= Session token lifecycle management (renewal, re-login and revocation) +== Session token lifecycle management (renewal, re-login and revocation) A Vault session token (also referred to as `LoginToken`) is quite similar to a lease as it has a TTL, max TTL, and may expire. Once a login token expires, it cannot be used anymore to interact with Vault. @@ -148,7 +138,6 @@ Session lifecycle is enabled by default and can be disabled by setting `spring.c to `false`. Disabling is not recommended as session tokens can expire and Spring Cloud Vault cannot longer access Vault. -==== [source,yaml] ---- spring.cloud.vault: @@ -157,7 +146,6 @@ spring.cloud.vault: refresh-before-expiry: 10s expiry-threshold: 20s ---- -==== * `enabled` controls whether session lifecycle management is enabled to renew session tokens. Enabled by default. diff --git a/docs/modules/ROOT/pages/quickstart.adoc b/docs/modules/ROOT/pages/quickstart.adoc index 56e41b41..434eb34c 100644 --- a/docs/modules/ROOT/pages/quickstart.adoc +++ b/docs/modules/ROOT/pages/quickstart.adoc @@ -1,4 +1,5 @@ -:docs: https://cloud.spring.io/spring-cloud-vault/reference/html/ +[[quick-start]] += Quick Start *Prerequisites* @@ -127,13 +128,12 @@ where the "application" is injected as the `spring.application.name` in the Properties retrieved from Vault will be used "as-is" without further prefixing of the property names. [[client-side-usage]] -= Client Side Usage +== Client Side Usage To use these features in an application, just build it as a Spring Boot application that depends on `spring-cloud-vault-config` (e.g. see the test cases). Example Maven configuration: .pom.xml -==== [source,xml,indent=0,subs="verbatim,quotes,attributes"] ---- @@ -167,11 +167,9 @@ Example Maven configuration: ---- -==== Then you can create a standard Spring Boot application, like this simple HTTP server: -==== [source,java] ---- @SpringBootApplication @@ -188,13 +186,11 @@ public class Application { } } ---- -==== When it runs it will pick up the external configuration from the default local Vault server on port `8200` if it is running. To modify the startup behavior you can change the location of the Vault server using `application.properties`, for example .application.yml -==== [source,yaml] ---- spring.cloud.vault: @@ -207,7 +203,6 @@ spring.cloud.vault: config: spring.config.import: vault:// ---- -==== * `host` sets the hostname of the Vault host. The host name will be used for SSL certificate validation @@ -221,8 +216,8 @@ Supported schemes are `http` and `https`. Enabling further integrations requires additional dependencies and configuration. Depending on how you have set up Vault you might need additional configuration like -{docs}#vault.config.ssl[SSL] and -{docs}#vault.config.authentication[authentication]. +xref:other-topics.adoc#vault.config.ssl[SSL] and +xref:authentication.adoc#vault.config.authentication[authentication]. If the application imports the `spring-boot-starter-actuator` project, the status of the vault server will be available via the `/health` endpoint. @@ -237,19 +232,17 @@ You can enable the bootstrap context either by setting the configuration propert Vault requires an https://www.vaultproject.io/docs/concepts/auth.html[authentication mechanism] to https://www.vaultproject.io/docs/concepts/tokens.html[authorize client requests]. -Spring Cloud Vault supports multiple {docs}#vault.config.authentication[authentication mechanisms] to authenticate applications with Vault. +Spring Cloud Vault supports multiple xref:authentication.adoc#vault.config.authentication[authentication mechanisms] to authenticate applications with Vault. For a quickstart, use the root token printed by the xref:quickstart.adoc#quickstart.vault.start[Vault initialization]. .application.yml -==== [source,yaml] ---- spring.cloud.vault: token: 19aefa97-cccc-bbbb-aaaa-225940e63d76 spring.config.import: vault:// ---- -==== WARNING: Consider carefully your security requirements. Static token authentication is fine if you want quickly get started with Vault, but a static token is not protected any further. diff --git a/docs/modules/ROOT/pages/secret-backends.adoc b/docs/modules/ROOT/pages/secret-backends.adoc index e83ae86d..a05b454c 100644 --- a/docs/modules/ROOT/pages/secret-backends.adoc +++ b/docs/modules/ROOT/pages/secret-backends.adoc @@ -45,7 +45,6 @@ Properties are exposed like they are stored (i.e. without additional prefixes). NOTE: Spring Cloud Vault adds the `data/` context between the mount path and the actual context path depending on whether the mount uses the versioned key-value backend. -==== [source,yaml] ---- spring.cloud.vault: @@ -57,7 +56,6 @@ spring.cloud.vault: application-name: my-app profiles: local, cloud ---- -==== * `enabled` setting this value to `false` disables the secret backend config usage * `backend` sets the path of the secret mount to use @@ -81,7 +79,6 @@ The Consul integration requires the `spring-cloud-vault-config-consul` dependency. .pom.xml -==== [source,xml,indent=0,subs="verbatim,quotes,attributes"] ---- @@ -92,7 +89,6 @@ dependency. ---- -==== The integration can be enabled by setting `spring.cloud.vault.consul.enabled=true` (default `false`) and providing the role name with `spring.cloud.vault.consul.role=…`. @@ -101,7 +97,6 @@ The obtained token is stored in `spring.cloud.consul.token` so using Spring Cloud Consul can pick up the generated credentials without further configuration. You can configure the property name by setting `spring.cloud.vault.consul.token-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -111,7 +106,6 @@ spring.cloud.vault: backend: consul token-property: spring.cloud.consul.token ---- -==== * `enabled` setting this value to `true` enables the Consul backend config usage * `role` sets the role name of the Consul role definition @@ -129,7 +123,6 @@ The RabbitMQ integration requires the `spring-cloud-vault-config-rabbitmq` dependency. .pom.xml -==== [source,xml,indent=0,subs="verbatim,quotes,attributes"] ---- @@ -140,7 +133,6 @@ dependency. ---- -==== The integration can be enabled by setting `spring.cloud.vault.rabbitmq.enabled=true` (default `false`) and providing the role name with `spring.cloud.vault.rabbitmq.role=…`. @@ -150,7 +142,6 @@ and `spring.rabbitmq.password` so using Spring Boot will pick up the generated c You can configure the property names by setting `spring.cloud.vault.rabbitmq.username-property` and `spring.cloud.vault.rabbitmq.password-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -161,7 +152,6 @@ spring.cloud.vault: username-property: spring.rabbitmq.username password-property: spring.rabbitmq.password ---- -==== * `enabled` setting this value to `true` enables the RabbitMQ backend config usage * `role` sets the role name of the RabbitMQ role definition @@ -180,7 +170,6 @@ The AWS integration requires the `spring-cloud-vault-config-aws` dependency. .pom.xml -==== [source,xml,indent=0,subs="verbatim,quotes,attributes"] ---- @@ -191,7 +180,6 @@ dependency. ---- -==== The integration can be enabled by setting `spring.cloud.vault.aws=true` (default `false`) and providing the role name with `spring.cloud.vault.aws.role=…`. @@ -212,7 +200,6 @@ For STS security token, you can configure the property name by setting `spring.c Example: iam_user -==== [source,yaml] ---- spring.cloud.vault: @@ -223,10 +210,8 @@ spring.cloud.vault: access-key-property: cloud.aws.credentials.accessKey secret-key-property: cloud.aws.credentials.secretKey ---- -==== Example: assumed_role (STS) -==== [source,yaml] ---- spring.cloud.vault: @@ -241,7 +226,6 @@ spring.cloud.vault: ttl: 3600s role-arn: arn:aws:iam::${AWS_ACCOUNT}:role/sts-app-role ---- -==== * `enabled` setting this value to `true` enables the AWS backend config usage * `role` sets the role name of the AWS role definition @@ -256,7 +240,7 @@ spring.cloud.vault: See also: https://www.vaultproject.io/docs/secrets/aws/index.html[Vault Documentation: Setting up AWS with Vault] [[vault.config.backends.database-backends]] -= Database backends +== Database backends Vault supports several database secret backends to generate database credentials dynamically based on configured roles. This means services that need to access a database no longer need to configure credentials: they can request them from Vault, and use Vault's leasing mechanism to more easily roll keys. @@ -279,7 +263,6 @@ You can use that specific backend by using the generic database backend. Make sure to specify the appropriate backend path, e.g. `spring.cloud.vault.mysql.role.backend=database`. .pom.xml -==== [source,xml,indent=0,subs="verbatim,quotes,attributes"] ---- @@ -290,7 +273,6 @@ Make sure to specify the appropriate backend path, e.g. `spring.cloud.vault.mysq ---- -==== NOTE: Enabling multiple JDBC-compliant databases will generate credentials and store them by default in the same property keys hence property names for JDBC secrets need to be configured separately. @@ -310,7 +292,6 @@ You can configure the property names by setting `spring.cloud.vault.database.username-property` and `spring.cloud.vault.database.password-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -321,7 +302,6 @@ spring.cloud.vault: username-property: spring.datasource.username password-property: spring.datasource.password ---- -==== [[vault.config.backends.databases]] == Multiple Databases @@ -331,7 +311,6 @@ Beginning with version 3.0.5, Spring Vault supports the configuration of multipl The configuration accepts multiple database backends to materialize credentials into the specified properties. Make sure to configure `username-property` and `password-property` appropriately. -==== [source,yaml] ---- spring.cloud.vault: @@ -349,7 +328,6 @@ spring.cloud.vault: username-property: spring.secondary-datasource.username password-property: spring.secondary-datasource.password ---- -==== * `` descriptive name of the database configuration. * `.enabled` setting this value to `true` enables the Database backend config usage @@ -378,7 +356,6 @@ You can configure the property names by setting `spring.cloud.vault.cassandra.username-property` and `spring.cloud.vault.cassandra.password-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -389,7 +366,6 @@ spring.cloud.vault: username-property: spring.data.cassandra.username password-property: spring.data.cassandra.password ---- -==== * `enabled` setting this value to `true` enables the Cassandra backend config usage * `role` sets the role name of the Cassandra role definition @@ -412,7 +388,6 @@ You can configure the property names by setting `spring.cloud.vault.couchbase.username-property` and `spring.cloud.vault.couchbase.password-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -423,7 +398,6 @@ spring.cloud.vault: username-property: spring.couchbase.username password-property: spring.couchbase.password ---- -==== * `enabled` setting this value to `true` enables the Couchbase backend config usage * `role` sets the role name of the Couchbase role definition @@ -446,7 +420,6 @@ You can configure the property names by setting `spring.cloud.vault.elasticsearch.username-property` and `spring.cloud.vault.elasticsearch.password-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -457,7 +430,6 @@ spring.cloud.vault: username-property: spring.elasticsearch.rest.username password-property: spring.elasticsearch.rest.password ---- -==== * `enabled` setting this value to `true` enables the Elasticsearch database backend config usage * `role` sets the role name of the Elasticsearch role definition @@ -482,7 +454,6 @@ You can configure the property names by setting `spring.cloud.vault.mongodb.username-property` and `spring.cloud.vault.mongodb.password-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -493,7 +464,6 @@ spring.cloud.vault: username-property: spring.data.mongodb.username password-property: spring.data.mongodb.password ---- -==== * `enabled` setting this value to `true` enables the MongodB backend config usage * `role` sets the role name of the MongoDB role definition @@ -519,7 +489,6 @@ You can configure the property names by setting `spring.cloud.vault.mysql.username-property` and `spring.cloud.vault.mysql.password-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -530,7 +499,6 @@ spring.cloud.vault: username-property: spring.datasource.username password-property: spring.datasource.password ---- -==== * `enabled` setting this value to `true` enables the MySQL backend config usage * `role` sets the role name of the MySQL role definition @@ -556,7 +524,6 @@ You can configure the property names by setting `spring.cloud.vault.postgresql.username-property` and `spring.cloud.vault.postgresql.password-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -567,7 +534,6 @@ spring.cloud.vault: username-property: spring.datasource.username password-property: spring.datasource.password ---- -==== * `enabled` setting this value to `true` enables the PostgreSQL backend config usage * `role` sets the role name of the PostgreSQL role definition @@ -578,7 +544,7 @@ spring.cloud.vault: See also: https://www.vaultproject.io/docs/secrets/postgresql/index.html[Vault Documentation: Setting up PostgreSQL with Vault] [[vault.config.backends.configurer]] -= Customize which secret backends to expose as PropertySource +== Customize which secret backends to expose as PropertySource Spring Cloud Vault uses property-based configuration to create ``PropertySource``s for key-value and discovered secret backends. @@ -592,7 +558,6 @@ Default key-value and discovered backend registration is disabled if you provide You can however enable default registration with `SecretBackendConfigurer.registerDefaultKeyValueSecretBackends()` and `SecretBackendConfigurer.registerDefaultDiscoveredSecretBackends()`. -==== [source,java] ---- public class CustomizationBean implements VaultConfigurer { @@ -612,10 +577,9 @@ public class CustomizationBean implements VaultConfigurer { SpringApplication application = new SpringApplication(MyApplication.class); application.addBootstrapper(VaultBootstrapper.fromConfigurer(new CustomizationBean())); ---- -==== [[vault.config.backends.custom]] -= Custom Secret Backend Implementations +== Custom Secret Backend Implementations Spring Cloud Vault ships with secret backend support for the most common backend integrations. You can integrate with any kind of backend by providing an implementation that describes how to obtain data from the backend you want to use and how to surface data provided by that backend by providing a `PropertyTransformer`. diff --git a/docs/modules/ROOT/pages/spring-cloud-vault.adoc b/docs/modules/ROOT/pages/spring-cloud-vault.adoc deleted file mode 100644 index a44d3bf1..00000000 --- a/docs/modules/ROOT/pages/spring-cloud-vault.adoc +++ /dev/null @@ -1,25 +0,0 @@ -[[spring-cloud-vault]] -= Spring Cloud Vault -:page-section-summary-toc: 1 -:page-section-summary-toc: 1 -:github: https://github.com/spring-cloud/spring-cloud-vault -:githubmaster: {github}/tree/master -:revnumber: {project-version} -:docslink: {githubmaster}/docs/src/main/asciidoc -:nofooter: - -(C) 2016-2021 the original authors. - -NOTE: _Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically._ - - - - -[[quick-start]] -== Quick Start - - - - - - diff --git a/docs/modules/ROOT/pages/_configprops.adoc b/docs/modules/ROOT/partials/_configprops.adoc similarity index 99% rename from docs/modules/ROOT/pages/_configprops.adoc rename to docs/modules/ROOT/partials/_configprops.adoc index 0a77b628..c63e2b7a 100644 --- a/docs/modules/ROOT/pages/_configprops.adoc +++ b/docs/modules/ROOT/partials/_configprops.adoc @@ -137,4 +137,4 @@ |spring.cloud.vault.token | | Static vault token. Required if {@link #authentication} is {@code TOKEN}. |spring.cloud.vault.uri | | Vault URI. Can be set with scheme, host and port. -|=== +|=== \ No newline at end of file diff --git a/docs/pom.xml b/docs/pom.xml index a0ea35a7..6a1cbeda 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -3,29 +3,24 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - + org.springframework.cloud + spring-cloud-vault-docs org.springframework.cloud spring-cloud-vault-parent 4.1.0-SNAPSHOT .. - - spring-cloud-vault-docs - 4.1.0-SNAPSHOT - jar Spring Cloud Vault Docs - Spring Cloud Docs - + Spring Cloud Vault Docs spring-cloud-vault ${basedir}/.. - spring.cloud.vault.*| - - deploy + spring.cloud.vault.* + + none - ${project.groupId} @@ -48,7 +43,6 @@ spring-cloud-vault-config-rabbitmq - src/main/asciidoc @@ -81,11 +75,16 @@ - docs + + + src/main/antora/resources/antora-resources + true + + pl.project13.maven @@ -96,17 +95,17 @@ maven-dependency-plugin - org.apache.maven.plugins - maven-resources-plugin + io.spring.maven.antora + antora-component-version-maven-plugin + + + io.spring.maven.antora + antora-maven-plugin org.codehaus.mojo exec-maven-plugin - - org.asciidoctor - asciidoctor-maven-plugin - org.apache.maven.plugins maven-antrun-plugin @@ -118,15 +117,4 @@ - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - diff --git a/docs/src/main/antora/resources/antora-resources/antora.yml b/docs/src/main/antora/resources/antora-resources/antora.yml new file mode 100644 index 00000000..9148923f --- /dev/null +++ b/docs/src/main/antora/resources/antora-resources/antora.yml @@ -0,0 +1,20 @@ +version: @antora-component.version@ +prerelease: @antora-component.prerelease@ + +asciidoc: + attributes: + attribute-missing: 'warn' + chomp: 'all' + project-root: @maven.multiModuleProjectDirectory@ + github-repo: @docs.main@ + github-raw: https://raw.githubusercontent.com/spring-cloud/@docs.main@/@github-tag@ + github-code: https://github.com/spring-cloud/@docs.main@/tree/@github-tag@ + github-issues: https://github.com/spring-cloud/@docs.main@/issues/ + github-wiki: https://github.com/spring-cloud/@docs.main@/wiki + spring-cloud-version: @project.version@ + github-tag: @github-tag@ + version-type: @version-type@ + docs-url: https://docs.spring.io/@docs.main@/docs/@project.version@ + raw-docs-url: https://raw.githubusercontent.com/spring-cloud/@docs.main@/@github-tag@ + project-version: @project.version@ + project-name: @docs.main@ diff --git a/docs/modules/ROOT/pages/README.adoc b/docs/src/main/asciidoc/README.adoc similarity index 95% rename from docs/modules/ROOT/pages/README.adoc rename to docs/src/main/asciidoc/README.adoc index bff0b295..5d4a9b8a 100644 --- a/docs/modules/ROOT/pages/README.adoc +++ b/docs/src/main/asciidoc/README.adoc @@ -1,6 +1,5 @@ :docs: https://cloud.spring.io/spring-cloud-vault/spring-cloud-vault.html - [[features]] = Features @@ -9,6 +8,7 @@ Specifically for Spring applications: +// TODO: fix links * Retrieve secrets from Vault and initialize Spring Environment with remote property sources. * Obtain {docs}#vault.config.backends.kv[Key-Value secrets] secured with SSL. * Generate credentials for @@ -29,9 +29,7 @@ Specifically for Spring applications: * Bootstrap application context: a parent context for the main application that can be trained to do anything. -[[quick-start]] -= Quick Start - +include::../../../modules/ROOT/pages/quickstart.adoc[] [[building]] = Building @@ -65,7 +63,7 @@ $ ./docs/src/main/ruby/generate_readme.sh > README.adoc This script requires ruby and the asciidoctor gem installed (`gem install asciidoctor`) -include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/building.adoc[] +include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/pages/building.adoc[] [[contributing]] = Contributing