Skip to content

Commit 0f0424a

Browse files
rwinchSteve Riesenberg
authored and
Steve Riesenberg
committed
Migrate docs to Antora
Issue gh-1295
1 parent ec3d4fa commit 0f0424a

File tree

62 files changed

+327
-198
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+327
-198
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ out/
3737

3838
### Mac ###
3939
.DS_Store
40+
cached-antora-playbook.yml
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Deploy Docs
2+
on:
3+
push:
4+
branches-ignore: [ gh-pages ]
5+
tags: '**'
6+
repository_dispatch:
7+
types: request-build-reference # legacy
8+
#schedule:
9+
#- cron: '0 10 * * *' # Once per day at 10am UTC
10+
workflow_dispatch:
11+
permissions:
12+
actions: write
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
# FIXME enable when pushed to spring-projects
17+
# if: github.repository_owner == 'spring-projects'
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
with:
22+
ref: docs-build
23+
fetch-depth: 1
24+
- name: Dispatch (partial build)
25+
if: github.ref_type == 'branch'
26+
env:
27+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: gh workflow run deploy-docs.yml -r $(git rev-parse --abbrev-ref HEAD) -f build-refname=${{ github.ref_name }}
29+
- name: Dispatch (full build)
30+
if: github.ref_type == 'tag'
31+
env:
32+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
run: gh workflow run deploy-docs.yml -r $(git rev-parse --abbrev-ref HEAD)

docs/antora-playbook.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# PACKAGES [email protected] @antora/atlas-extension:1.0.0-alpha.1 @antora/[email protected] @springio/[email protected] @asciidoctor/[email protected] @opendevise/[email protected]
2+
#
3+
# The purpose of this Antora playbook is to build the docs in the current branch.
4+
antora:
5+
extensions:
6+
- '@antora/collector-extension'
7+
- require: '@springio/antora-extensions/tabs-migration-extension'
8+
unwrap_example_block: always
9+
- require: '@springio/antora-extensions/root-component-extension'
10+
root_component_name: 'authorization-server'
11+
- '@antora/atlas-extension'
12+
site:
13+
title: Spring Authorization Server
14+
url: https://https://rwinch.github.io/spring-authorization-server/
15+
content:
16+
sources:
17+
- url: ..
18+
branches: antora
19+
start_path: docs
20+
worktrees: true
21+
asciidoc:
22+
attributes:
23+
page-pagination: ''
24+
hide-uri-scheme: '@'
25+
tabs-sync-option: '@'
26+
chomp: 'all'
27+
extensions:
28+
- '@asciidoctor/tabs'
29+
- '@springio/asciidoctor-extensions'
30+
sourcemap: true
31+
urls:
32+
latest_version_segment: ''
33+
runtime:
34+
log:
35+
failure_level: warn
36+
ui:
37+
bundle:
38+
url: https://github.com/spring-io/antora-ui-spring/releases/download/latest/ui-bundle.zip
39+
snapshot: true

docs/antora.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: authorization-server
2+
version: true
3+
title: Spring Authorization Server
4+
nav:
5+
- modules/ROOT/nav.adoc
6+
ext:
7+
collector:
8+
run:
9+
command: gradlew -q -PbuildSrc.skipTests=true "-Dorg.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError" :spring-authorization-server-docs:generateAntoraYml
10+
local: true
11+
scan:
12+
dir: ./build/generated-antora-resources
13+
14+
asciidoc:
15+
attributes:
16+
attribute-missing: 'warn'
17+
chomp: 'all'
18+
spring-security-reference-base-url: "https://docs.spring.io/spring-security/reference"
19+
spring-security-api-base-url: "https://docs.spring.io/spring-security/site/docs/current/api"
20+
spring-boot-reference-base-url: "https://docs.spring.io/spring-boot/docs/current/reference/html"
21+
examples-dir: example$docs-src
22+
samples-dir: example$samples
23+
docs-java: '{examples-dir}/main/java'

docs/modules/ROOT/examples/docs-src

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../src

docs/modules/ROOT/examples/samples

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../samples

docs/modules/ROOT/nav.adoc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
* xref:index.adoc[]
2+
* xref:getting-help.adoc[]
3+
* xref:getting-started.adoc[]
4+
* xref:configuration-model.adoc[]
5+
* xref:core-model-components.adoc[]
6+
* xref:protocol-endpoints.adoc[]
7+
* xref:how-to.adoc[]
8+
** xref:guides/how-to-ext-grant-type.adoc[]
9+
** xref:guides/how-to-jpa.adoc[]
10+
** xref:guides/how-to-pkce.adoc[]
11+
** xref:guides/how-to-social-login.adoc[]
12+
** xref:guides/how-to-userinfo.adoc[]

docs/src/docs/asciidoc/configuration-model.adoc renamed to docs/modules/ROOT/pages/configuration-model.adoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
`OAuth2AuthorizationServerConfiguration` is a `@Configuration` that provides the minimal default configuration for an OAuth2 authorization server.
88

9-
`OAuth2AuthorizationServerConfiguration` uses <<customizing-the-configuration, `OAuth2AuthorizationServerConfigurer`>> to apply the default configuration and registers a `SecurityFilterChain` `@Bean` composed of all the infrastructure components supporting an OAuth2 authorization server.
9+
`OAuth2AuthorizationServerConfiguration` uses xref:configuration-model.adoc#customizing-the-configuration[`OAuth2AuthorizationServerConfigurer`] to apply the default configuration and registers a `SecurityFilterChain` `@Bean` composed of all the infrastructure components supporting an OAuth2 authorization server.
1010

1111
[TIP]
1212
`OAuth2AuthorizationServerConfiguration.applyDefaultSecurity(HttpSecurity)` is a convenience (`static`) utility method that applies the default OAuth2 security configuration to `HttpSecurity`.
@@ -135,9 +135,9 @@ public SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity h
135135
<1> `registeredClientRepository()`: The xref:core-model-components.adoc#registered-client-repository[`RegisteredClientRepository`] (*REQUIRED*) for managing new and existing clients.
136136
<2> `authorizationService()`: The xref:core-model-components.adoc#oauth2-authorization-service[`OAuth2AuthorizationService`] for managing new and existing authorizations.
137137
<3> `authorizationConsentService()`: The xref:core-model-components.adoc#oauth2-authorization-consent-service[`OAuth2AuthorizationConsentService`] for managing new and existing authorization consents.
138-
<4> `authorizationServerSettings()`: The <<configuring-authorization-server-settings, `AuthorizationServerSettings`>> (*REQUIRED*) for customizing configuration settings for the OAuth2 authorization server.
138+
<4> `authorizationServerSettings()`: The xref:configuration-model.adoc#configuring-authorization-server-settings[`AuthorizationServerSettings`] (*REQUIRED*) for customizing configuration settings for the OAuth2 authorization server.
139139
<5> `tokenGenerator()`: The xref:core-model-components.adoc#oauth2-token-generator[`OAuth2TokenGenerator`] for generating tokens supported by the OAuth2 authorization server.
140-
<6> `clientAuthentication()`: The configurer for <<configuring-client-authentication, OAuth2 Client Authentication>>.
140+
<6> `clientAuthentication()`: The configurer for xref:configuration-model.adoc#configuring-client-authentication[OAuth2 Client Authentication].
141141
<7> `authorizationEndpoint()`: The configurer for the xref:protocol-endpoints.adoc#oauth2-authorization-endpoint[OAuth2 Authorization endpoint].
142142
<8> `deviceAuthorizationEndpoint()`: The configurer for the xref:protocol-endpoints.adoc#oauth2-device-authorization-endpoint[OAuth2 Device Authorization endpoint].
143143
<9> `deviceVerificationEndpoint()`: The configurer for the xref:protocol-endpoints.adoc#oauth2-device-verification-endpoint[OAuth2 Device Verification endpoint].
@@ -186,7 +186,7 @@ public final class AuthorizationServerSettings extends AbstractSettings {
186186
`AuthorizationServerSettings` is a *REQUIRED* component.
187187

188188
[TIP]
189-
<<default-configuration, `@Import(OAuth2AuthorizationServerConfiguration.class)`>> automatically registers an `AuthorizationServerSettings` `@Bean`, if not already provided.
189+
xref:configuration-model.adoc#default-configuration[`@Import(OAuth2AuthorizationServerConfiguration.class)`] automatically registers an `AuthorizationServerSettings` `@Bean`, if not already provided.
190190

191191
The following example shows how to customize the configuration settings and register an `AuthorizationServerSettings` `@Bean`:
192192

docs/src/docs/asciidoc/core-model-components.adoc renamed to docs/modules/ROOT/pages/core-model-components.adoc

+13-13
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ The `OAuth2AuthorizationServerConfigurer` is useful when applying multiple confi
141141
[[oauth2-authorization]]
142142
== OAuth2Authorization
143143

144-
An `OAuth2Authorization` is a representation of an OAuth2 authorization, which holds state related to the authorization granted to a <<registered-client, client>>, by the resource owner or itself in the case of the `client_credentials` authorization grant type.
144+
An `OAuth2Authorization` is a representation of an OAuth2 authorization, which holds state related to the authorization granted to a xref:core-model-components.adoc#registered-client[client], by the resource owner or itself in the case of the `client_credentials` authorization grant type.
145145

146146
[TIP]
147147
The corresponding authorization model in Spring Security's OAuth2 Client support is {spring-security-reference-base-url}/servlet/oauth2/client/core.html#oauth2Client-authorized-client[OAuth2AuthorizedClient].
@@ -174,7 +174,7 @@ public class OAuth2Authorization implements Serializable {
174174
}
175175
----
176176
<1> `id`: The ID that uniquely identifies the `OAuth2Authorization`.
177-
<2> `registeredClientId`: The ID that uniquely identifies the <<registered-client, RegisteredClient>>.
177+
<2> `registeredClientId`: The ID that uniquely identifies the xref:core-model-components.adoc#registered-client[RegisteredClient].
178178
<3> `principalName`: The principal name of the resource owner (or client).
179179
<4> `authorizationGrantType`: The `AuthorizationGrantType` used.
180180
<5> `authorizedScopes`: The `Set` of scope(s) authorized for the client.
@@ -236,7 +236,7 @@ The `OAuth2AuthorizationServerConfigurer` is useful when applying multiple confi
236236
[[oauth2-authorization-consent]]
237237
== OAuth2AuthorizationConsent
238238

239-
An `OAuth2AuthorizationConsent` is a representation of an authorization "consent" (decision) from an https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.1[OAuth2 authorization request flow] – for example, the `authorization_code` grant, which holds the authorities granted to a <<registered-client, client>> by the resource owner.
239+
An `OAuth2AuthorizationConsent` is a representation of an authorization "consent" (decision) from an https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.1[OAuth2 authorization request flow] – for example, the `authorization_code` grant, which holds the authorities granted to a xref:core-model-components.adoc#registered-client[client] by the resource owner.
240240

241241
When authorizing access to a client, the resource owner may grant only a subset of the authorities requested by the client.
242242
The typical use case is the `authorization_code` grant flow, in which the client requests scope(s) and the resource owner grants (or denies) access to the requested scope(s).
@@ -256,7 +256,7 @@ public final class OAuth2AuthorizationConsent implements Serializable {
256256
257257
}
258258
----
259-
<1> `registeredClientId`: The ID that uniquely identifies the <<registered-client, RegisteredClient>>.
259+
<1> `registeredClientId`: The ID that uniquely identifies the xref:core-model-components.adoc#registered-client[RegisteredClient].
260260
<2> `principalName`: The principal name of the resource owner.
261261
<3> `authorities`: The authorities granted to the client by the resource owner. An authority can represent a scope, a claim, a permission, a role, and others.
262262

@@ -308,7 +308,7 @@ The `OAuth2AuthorizationServerConfigurer` is useful when applying multiple confi
308308
[[oauth2-token-context]]
309309
== OAuth2TokenContext
310310

311-
An `OAuth2TokenContext` is a context object that holds information associated with an `OAuth2Token` and is used by an <<oauth2-token-generator, OAuth2TokenGenerator>> and <<oauth2-token-customizer, OAuth2TokenCustomizer>>.
311+
An `OAuth2TokenContext` is a context object that holds information associated with an `OAuth2Token` and is used by an xref:core-model-components.adoc#oauth2-token-generator[OAuth2TokenGenerator] and xref:core-model-components.adoc#oauth2-token-customizer[OAuth2TokenCustomizer].
312312

313313
`OAuth2TokenContext` provides the following accessors:
314314

@@ -337,10 +337,10 @@ public interface OAuth2TokenContext extends Context {
337337
338338
}
339339
----
340-
<1> `getRegisteredClient()`: The <<registered-client, RegisteredClient>> associated with the authorization grant.
340+
<1> `getRegisteredClient()`: The xref:core-model-components.adoc#registered-client[RegisteredClient] associated with the authorization grant.
341341
<2> `getPrincipal()`: The `Authentication` instance of the resource owner (or client).
342342
<3> `getAuthorizationServerContext()`: The xref:configuration-model.adoc#configuring-authorization-server-settings[`AuthorizationServerContext`] object that holds information of the Authorization Server runtime environment.
343-
<4> `getAuthorization()`: The <<oauth2-authorization, OAuth2Authorization>> associated with the authorization grant.
343+
<4> `getAuthorization()`: The xref:core-model-components.adoc#oauth2-authorization[OAuth2Authorization] associated with the authorization grant.
344344
<5> `getAuthorizedScopes()`: The scope(s) authorized for the client.
345345
<6> `getTokenType()`: The `OAuth2TokenType` to generate. The supported values are `code`, `access_token`, `refresh_token`, and `id_token`.
346346
<7> `getAuthorizationGrantType()`: The `AuthorizationGrantType` associated with the authorization grant.
@@ -349,7 +349,7 @@ public interface OAuth2TokenContext extends Context {
349349
[[oauth2-token-generator]]
350350
== OAuth2TokenGenerator
351351

352-
An `OAuth2TokenGenerator` is responsible for generating an `OAuth2Token` from the information contained in the provided <<oauth2-token-context, OAuth2TokenContext>>.
352+
An `OAuth2TokenGenerator` is responsible for generating an `OAuth2Token` from the information contained in the provided xref:core-model-components.adoc#oauth2-token-context[OAuth2TokenContext].
353353

354354
The `OAuth2Token` generated primarily depends on the type of `OAuth2TokenType` specified in the `OAuth2TokenContext`.
355355

@@ -360,11 +360,11 @@ For example, when the `value` for `OAuth2TokenType` is:
360360
* `refresh_token`, then `OAuth2RefreshToken` is generated.
361361
* `id_token`, then `OidcIdToken` is generated.
362362

363-
Furthermore, the format of the generated `OAuth2AccessToken` varies, depending on the `TokenSettings.getAccessTokenFormat()` configured for the <<registered-client, RegisteredClient>>.
363+
Furthermore, the format of the generated `OAuth2AccessToken` varies, depending on the `TokenSettings.getAccessTokenFormat()` configured for the xref:core-model-components.adoc#registered-client[RegisteredClient].
364364
If the format is `OAuth2TokenFormat.SELF_CONTAINED` (the default), then a `Jwt` is generated.
365365
If the format is `OAuth2TokenFormat.REFERENCE`, then an "opaque" token is generated.
366366

367-
Finally, if the generated `OAuth2Token` has a set of claims and implements `ClaimAccessor`, the claims are made accessible from <<oauth2-authorization, OAuth2Authorization.Token.getClaims()>>.
367+
Finally, if the generated `OAuth2Token` has a set of claims and implements `ClaimAccessor`, the claims are made accessible from xref:core-model-components.adoc#oauth2-authorization[OAuth2Authorization.Token.getClaims()].
368368

369369
The `OAuth2TokenGenerator` is primarily used by components that implement authorization grant processing – for example, `authorization_code`, `client_credentials`, and `refresh_token`.
370370

@@ -419,8 +419,8 @@ The `OAuth2AuthorizationServerConfigurer` is useful when applying multiple confi
419419
[[oauth2-token-customizer]]
420420
== OAuth2TokenCustomizer
421421

422-
An `OAuth2TokenCustomizer` provides the ability to customize the attributes of an `OAuth2Token`, which are accessible in the provided <<oauth2-token-context, OAuth2TokenContext>>.
423-
It is used by an <<oauth2-token-generator, OAuth2TokenGenerator>> to let it customize the attributes of the `OAuth2Token` before it is generated.
422+
An `OAuth2TokenCustomizer` provides the ability to customize the attributes of an `OAuth2Token`, which are accessible in the provided xref:core-model-components.adoc#oauth2-token-context[OAuth2TokenContext].
423+
It is used by an xref:core-model-components.adoc#oauth2-token-generator[OAuth2TokenGenerator] to let it customize the attributes of the `OAuth2Token` before it is generated.
424424

425425
An `OAuth2TokenCustomizer<OAuth2TokenClaimsContext>` declared with a generic type of `OAuth2TokenClaimsContext` (`implements OAuth2TokenContext`) provides the ability to customize the claims of an "opaque" `OAuth2AccessToken`.
426426
`OAuth2TokenClaimsContext.getClaims()` provides access to the `OAuth2TokenClaimsSet.Builder`, allowing the ability to add, replace, and remove claims.
@@ -492,7 +492,7 @@ public OAuth2TokenCustomizer<JwtEncodingContext> jwtCustomizer() {
492492
If the `OAuth2TokenGenerator` is not provided as a `@Bean` or is not configured through the `OAuth2AuthorizationServerConfigurer`, an `OAuth2TokenCustomizer<JwtEncodingContext>` `@Bean` will automatically be configured with a `JwtGenerator`.
493493

494494
[TIP]
495-
For an example showing how you can xref:guides/how-to-userinfo.adoc#customize-id-token[customize the ID token], see the guide xref:guides/how-to-userinfo.adoc#how-to-userinfo[How-to: Customize the OpenID Connect 1.0 UserInfo response].
495+
For an example showing how you can xref:guides/how-to-userinfo.adoc#customize-id-token[customize the ID token], see the guide xref:guides/how-to-userinfo.adoc[How-to: Customize the OpenID Connect 1.0 UserInfo response].
496496

497497
[[session-registry]]
498498
== SessionRegistry

docs/src/docs/asciidoc/getting-help.adoc renamed to docs/modules/ROOT/pages/getting-help.adoc

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[[getting-help]]
22
= Getting Help
3+
:page-section-summary-toc: 1
34

45
[[community]]
56
== Community

docs/src/docs/asciidoc/getting-started.adoc renamed to docs/modules/ROOT/pages/getting-started.adoc

+17-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
include::attributes.adoc[]
21

32
[[getting-started]]
43
= Getting Started
@@ -19,8 +18,11 @@ The easiest way to begin using Spring Authorization Server is by creating a http
1918
You can use https://start.spring.io[start.spring.io] to generate a basic project or use the https://github.com/spring-projects/spring-authorization-server/tree/main/samples/default-authorizationserver[default authorization server sample] as a guide.
2019
Then add Spring Boot's starter for Spring Authorization Server as a dependency:
2120

21+
[tabs]
22+
======
23+
Maven::
24+
+
2225
[[spring-boot-maven-dependency]]
23-
.Maven
2426
[source,xml,role="primary",subs="attributes,verbatim"]
2527
----
2628
<dependency>
@@ -29,19 +31,24 @@ Then add Spring Boot's starter for Spring Authorization Server as a dependency:
2931
</dependency>
3032
----
3133
34+
Gradle::
35+
+
3236
[[spring-boot-gradle-dependency]]
33-
.Gradle
3437
[source,gradle,role="secondary",subs="attributes,verbatim"]
3538
----
3639
implementation "org.springframework.boot:spring-boot-starter-oauth2-authorization-server"
3740
----
41+
======
3842

3943
TIP: See https://docs.spring.io/spring-boot/docs/current/reference/html/getting-started.html#getting-started.installing[Installing Spring Boot] for more information on using Spring Boot with Maven or Gradle.
4044

4145
Alternatively, you can add Spring Authorization Server without Spring Boot using the following example:
4246

47+
[tabs]
48+
======
49+
Maven::
50+
+
4351
[[maven-dependency]]
44-
.Maven
4552
[source,xml,role="primary",subs="attributes,verbatim"]
4653
----
4754
<dependency>
@@ -51,12 +58,14 @@ Alternatively, you can add Spring Authorization Server without Spring Boot using
5158
</dependency>
5259
----
5360
61+
Gradle::
62+
+
5463
[[gradle-dependency]]
55-
.Gradle
5664
[source,gradle,role="secondary",subs="attributes,verbatim"]
5765
----
5866
implementation "org.springframework.security:spring-security-oauth2-authorization-server:{spring-authorization-server-version}"
5967
----
68+
======
6069

6170
[[developing-your-first-application]]
6271
== Developing Your First Application
@@ -67,10 +76,10 @@ To get started, you need the minimum required components defined as a `@Bean`. W
6776
.application.yml
6877
[source,yaml]
6978
----
70-
include::{docs-java}/sample/gettingStarted/application.yml[]
79+
include::{docs-java}/sample/gettingstarted/application.yml[]
7180
----
7281

73-
TIP: Beyond the Getting Started experience, most users will want to customize the default configuration. The <<defining-required-components,next section>> demonstrates providing all of the necessary beans yourself.
82+
TIP: Beyond the Getting Started experience, most users will want to customize the default configuration. The xref:getting-started.adoc#defining-required-components[next section] demonstrates providing all of the necessary beans yourself.
7483

7584
[[defining-required-components]]
7685
== Defining Required Components
@@ -83,7 +92,7 @@ These components can be defined as follows:
8392
.SecurityConfig.java
8493
[source,java]
8594
----
86-
include::{docs-java}/sample/gettingStarted/SecurityConfig.java[]
95+
include::{docs-java}/sample/gettingstarted/SecurityConfig.java[]
8796
----
8897

8998
This is a minimal configuration for getting started quickly. To understand what each component is used for, see the following descriptions:

0 commit comments

Comments
 (0)