Skip to content

Commit

Permalink
Fix bad numbering format for sectnums
Browse files Browse the repository at this point in the history
Fix

Fix other tutorial
  • Loading branch information
michelle-purcell committed Nov 9, 2023
1 parent c4011fb commit a933c66
Show file tree
Hide file tree
Showing 4 changed files with 1,012 additions and 18 deletions.
1 change: 1 addition & 0 deletions docs/src/main/asciidoc/_templates/template-tutorial.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ TODO:
[id="..."]
= Title using sentence capitalization

Check warning on line 13 in docs/src/main/asciidoc/_templates/template-tutorial.adoc

View workflow job for this annotation

GitHub Actions / Linting with Vale

[vale] reported by reviewdog 🐶 [Quarkus.TermsSuggestions] Depending on the context, consider using 'by using' or 'that uses' rather than 'using'. Raw Output: {"message": "[Quarkus.TermsSuggestions] Depending on the context, consider using 'by using' or 'that uses' rather than 'using'.", "location": {"path": "docs/src/main/asciidoc/_templates/template-tutorial.adoc", "range": {"start": {"line": 13, "column": 8}}}, "severity": "INFO"}
include::_attributes.adoc[]
:numbered:
:diataxis-type: tutorial
:categories: ...
////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ https://github.com/quarkusio/quarkus/tree/main/docs/src/main/asciidoc
[id="security-oidc-bearer-token-authentication-tutorial"]
= Protect a service application by using OpenID Connect (OIDC) Bearer token authentication
include::_attributes.adoc[]
:numbered:
:diataxis-type: tutorial
:categories: security
:topics: security,oidc,bearer-token,keycloak,authentication
Expand All @@ -19,6 +20,8 @@ For more information about OIDC Bearer token authentication, see the Quarkus xre

If you want to protect web applications by using OIDC Authorization Code Flow authentication, see the xref:security-oidc-code-flow-authentication.adoc[OpenID Connect authorization code flow mechanism for protecting web applications] guide.

:sectnums!:

== Prerequisites

:prerequisites-docker:
Expand Down Expand Up @@ -52,12 +55,10 @@ You can clone the Git repository by running the command `git clone {quickstarts-

The solution is located in the `security-openid-connect-quickstart` link:{quickstarts-tree-url}/security-openid-connect-quickstart[directory].

== Procedure

:sectnums:
:sectnumlevels: 3

=== Create the Maven project
== Create the Maven project

You can either create a new Maven project with the `oidc` extension or you can add the extension to an existing Maven project.
Complete one of the following commands:
Expand Down Expand Up @@ -106,7 +107,7 @@ implementation("io.quarkus:quarkus-oidc")
--
====

=== Write the application
== Write the application

. Implement the `/api/users/me` endpoint as shown in the following example, which is a regular Jakarta REST resource:

Check warning on line 112 in docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc

View workflow job for this annotation

GitHub Actions / Linting with Vale

[vale] reported by reviewdog 🐶 [Quarkus.TermsSuggestions] Depending on the context, consider using 'because' or 'while' rather than 'as'. Raw Output: {"message": "[Quarkus.TermsSuggestions] Depending on the context, consider using 'because' or 'while' rather than 'as'.", "location": {"path": "docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc", "range": {"start": {"line": 112, "column": 42}}}, "severity": "INFO"}
+
Expand Down Expand Up @@ -185,7 +186,7 @@ The main difference in this example is that the `@RolesAllowed` annotation is us

Injection of the `SecurityIdentity` is supported in both `@RequestScoped` and `@ApplicationScoped` contexts.

=== Configure the application
== Configure the application

* Configure the Quarkus OpenID Connect (OIDC) extension by setting the following configuration properties in the `src/main/resources/application.properties` file.
+
Expand Down Expand Up @@ -215,7 +216,7 @@ For more information, see the <<keycloak-dev-mode>> section.
For more information, see the Quarkus xref:security-oidc-configuration-properties-reference.adoc[OpenID Connect (OIDC) configuration properties] guide.


=== Start and configure the Keycloak server
== Start and configure the Keycloak server

. Put the link:{quickstarts-tree-url}/security-openid-connect-quickstart/config/quarkus-realm.json[realm configuration file] on the classpath (`target/classes` directory) so that it gets imported automatically when running in dev mode.
You do not need to do this if you have already built a link:{quickstarts-tree-url}/security-openid-connect-quickstart[complete solution], in which case, this realm file is added to the classpath during the build.

Check warning on line 222 in docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc

View workflow job for this annotation

GitHub Actions / Linting with Vale

[vale] reported by reviewdog 🐶 [Quarkus.Fluff] Depending on the context, consider using 'Rewrite the sentence, or use 'must', instead of' rather than 'need to'. Raw Output: {"message": "[Quarkus.Fluff] Depending on the context, consider using 'Rewrite the sentence, or use 'must', instead of' rather than 'need to'.", "location": {"path": "docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc", "range": {"start": {"line": 222, "column": 1}}}, "severity": "INFO"}

Check warning on line 222 in docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc

View workflow job for this annotation

GitHub Actions / Linting with Vale

[vale] reported by reviewdog 🐶 [Quarkus.TermsSuggestions] Depending on the context, consider using ', which (non restrictive clause preceded by a comma)' or 'that (restrictive clause without a comma)' rather than 'which'. Raw Output: {"message": "[Quarkus.TermsSuggestions] Depending on the context, consider using ', which (non restrictive clause preceded by a comma)' or 'that (restrictive clause without a comma)' rather than 'which'.", "location": {"path": "docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc", "range": {"start": {"line": 222, "column": 130}}}, "severity": "INFO"}
Expand Down Expand Up @@ -255,7 +256,7 @@ For more information, see the link:{url-quarkusio-guides}security-keycloak-admin


[[keycloak-dev-mode]]
=== Run the application in dev mode
== Run the application in dev mode

. To run the application in dev mode, run the following commands:
+
Expand All @@ -273,7 +274,7 @@ include::{includes}/devtools/dev.adoc[]
** Accessing `/api/admin` returns `200`.
** Accessing `/api/users/me` returns `200`.

=== Run the Application in JVM mode
== Run the Application in JVM mode

When you are done with dev mode, you can run the application as a standard Java application.

Expand All @@ -291,7 +292,7 @@ java -jar target/quarkus-app/quarkus-run.jar
----
====

=== Run the application in native mode
== Run the application in native mode

You can compile this same demo as-is into native mode without needing any modifications.

Check warning on line 297 in docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc

View workflow job for this annotation

GitHub Actions / Linting with Vale

[vale] reported by reviewdog 🐶 [Quarkus.TermsSuggestions] Depending on the context, consider using 'because' or 'while' rather than 'as'. Raw Output: {"message": "[Quarkus.TermsSuggestions] Depending on the context, consider using 'because' or 'while' rather than 'as'.", "location": {"path": "docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc", "range": {"start": {"line": 297, "column": 16}}}, "severity": "INFO"}
This implies that you no longer need to install a JVM on your production environment.

Check warning on line 298 in docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc

View workflow job for this annotation

GitHub Actions / Linting with Vale

[vale] reported by reviewdog 🐶 [Quarkus.Fluff] Depending on the context, consider using 'Rewrite the sentence, or use 'must', instead of' rather than 'need to'. Raw Output: {"message": "[Quarkus.Fluff] Depending on the context, consider using 'Rewrite the sentence, or use 'must', instead of' rather than 'need to'.", "location": {"path": "docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc", "range": {"start": {"line": 298, "column": 17}}}, "severity": "INFO"}
Expand All @@ -314,7 +315,7 @@ include::{includes}/devtools/build-native.adoc[]
----
====

=== Test the application
== Test the application

For information about testing your application in dev mode, see the preceding <<keycloak-dev-mode>> section.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ https://github.com/quarkusio/quarkus/tree/main/docs/src/main/asciidoc
[id="security-oidc-code-flow-authentication-tutorial"]
= Protect a web application by using OpenID Connect (OIDC) authorization code flow
include::_attributes.adoc[]
:numbered:
:diataxis-type: tutorial
:categories: security,web
:topics: security,oidc,keycloak,authorization
Expand All @@ -20,6 +21,8 @@ See also, xref:security-authentication-mechanisms.adoc#other-supported-authentic

If you want to protect your service applications by using OIDC Bearer token authentication, see xref:security-oidc-bearer-token-authentication-concept.adoc[OIDC Bearer token authentication].

:sectnums!:

== Prerequisites

:prerequisites-docker:
Expand All @@ -42,9 +45,10 @@ Clone the Git repository: `git clone {quickstarts-clone-url}`, or download an {q

The solution is located in the `security-openid-connect-web-authentication-quickstart` link:{quickstarts-tree-url}/security-openid-connect-web-authentication-quickstart[directory].

== Procedure
:sectnums:
:sectnumlevels: 3

=== Create the Maven project
== Create the Maven project

First, we need a new project.
Create a new project with the following command:
Expand Down Expand Up @@ -75,7 +79,7 @@ This will add the following to your build file:
implementation("io.quarkus:quarkus-oidc")
----

=== Write the application
== Write the application

Let's write a simple Jakarta REST resource which has all the tokens returned in the authorization code grant response injected:

Check warning on line 84 in docs/src/main/asciidoc/security-oidc-code-flow-authentication-tutorial.adoc

View workflow job for this annotation

GitHub Actions / Linting with Vale

[vale] reported by reviewdog 🐶 [Quarkus.TermsSuggestions] Depending on the context, consider using ', which (non restrictive clause preceded by a comma)' or 'that (restrictive clause without a comma)' rather than 'which'. Raw Output: {"message": "[Quarkus.TermsSuggestions] Depending on the context, consider using ', which (non restrictive clause preceded by a comma)' or 'that (restrictive clause without a comma)' rather than 'which'.", "location": {"path": "docs/src/main/asciidoc/security-oidc-code-flow-authentication-tutorial.adoc", "range": {"start": {"line": 84, "column": 43}}}, "severity": "INFO"}

Expand Down Expand Up @@ -155,7 +159,7 @@ Note that you do not have to inject the tokens - it is only required if the endp

// SJ: TO DO - update link to point to new reference guide. For more information, see <<access_id_and_access_tokens,Access ID and Access Tokens>> section.

=== Configure the application
== Configure the application

The OIDC extension allows you to define the configuration using the `application.properties` file which should be located at the `src/main/resources` directory.

Check warning on line 164 in docs/src/main/asciidoc/security-oidc-code-flow-authentication-tutorial.adoc

View workflow job for this annotation

GitHub Actions / Linting with Vale

[vale] reported by reviewdog 🐶 [Quarkus.TermsSuggestions] Depending on the context, consider using 'by using' or 'that uses' rather than 'using'. Raw Output: {"message": "[Quarkus.TermsSuggestions] Depending on the context, consider using 'by using' or 'that uses' rather than 'using'.", "location": {"path": "docs/src/main/asciidoc/security-oidc-code-flow-authentication-tutorial.adoc", "range": {"start": {"line": 164, "column": 58}}}, "severity": "INFO"}

Check warning on line 164 in docs/src/main/asciidoc/security-oidc-code-flow-authentication-tutorial.adoc

View workflow job for this annotation

GitHub Actions / Linting with Vale

[vale] reported by reviewdog 🐶 [Quarkus.TermsSuggestions] Depending on the context, consider using ', which (non restrictive clause preceded by a comma)' or 'that (restrictive clause without a comma)' rather than 'which'. Raw Output: {"message": "[Quarkus.TermsSuggestions] Depending on the context, consider using ', which (non restrictive clause preceded by a comma)' or 'that (restrictive clause without a comma)' rather than 'which'.", "location": {"path": "docs/src/main/asciidoc/security-oidc-code-flow-authentication-tutorial.adoc", "range": {"start": {"line": 164, "column": 98}}}, "severity": "INFO"}

Expand All @@ -179,7 +183,7 @@ Finally, the `quarkus.http.auth.permission.authenticated` permission is set to t
In this case, all paths are being protected by a policy that ensures that only `authenticated` users are allowed to access.
For more information, see xref:security-authorization-of-web-endpoints-reference.adoc[Security Authorization Guide].

=== Start and configure the Keycloak server
== Start and configure the Keycloak server

To start a Keycloak server, use Docker and run the following command:

Expand All @@ -198,7 +202,7 @@ Username should be `admin` and password `admin`.
Import the link:{quickstarts-tree-url}/security-openid-connect-web-authentication-quickstart/config/quarkus-realm.json[realm configuration file] to create a new realm.
For more information, see the Keycloak documentation about how to https://www.keycloak.org/docs/latest/server_admin/index.html#_create-realm[create a new realm].

=== Run the application in dev and JVM modes
== Run the application in dev and JVM modes

To run the application in a dev mode, use:

Expand All @@ -217,7 +221,7 @@ Then, run it:
java -jar target/quarkus-app/quarkus-run.jar
----

=== Run the application in Native mode
== Run the application in Native mode

This same demo can be compiled into native code.
No modifications are required.

Check warning on line 227 in docs/src/main/asciidoc/security-oidc-code-flow-authentication-tutorial.adoc

View workflow job for this annotation

GitHub Actions / Linting with Vale

[vale] reported by reviewdog 🐶 [Quarkus.SentenceLength] Try to keep sentences to an average of 32 words or fewer. Raw Output: {"message": "[Quarkus.SentenceLength] Try to keep sentences to an average of 32 words or fewer.", "location": {"path": "docs/src/main/asciidoc/security-oidc-code-flow-authentication-tutorial.adoc", "range": {"start": {"line": 227, "column": 17}}}, "severity": "INFO"}
Expand All @@ -237,7 +241,7 @@ After getting a cup of coffee, you can run this binary directly:
./target/security-openid-connect-web-authentication-quickstart-runner
----

=== Test the application
== Test the application

To test the application, open your browser and access the following URL:

Expand All @@ -255,6 +259,8 @@ After clicking the `Login` button, you are redirected back to the application.

For more information about writing the integration tests that depend on `Dev Services for Keycloak`, see the <<security-oidc-code-flow-authentication.adoc#integration-testing-keycloak-devservices, Dev Services for Keycloak>> section.

:sectnums!:

== Summary

Congratulations!
Expand Down
Loading

0 comments on commit a933c66

Please sign in to comment.