From 936444367b5d58feee364adabeb3941a9d2594ee Mon Sep 17 00:00:00 2001 From: Michelle Purcell Date: Tue, 7 Nov 2023 18:32:53 +0000 Subject: [PATCH] Fix bad numbering format for sectnums Fix Fix other tutorial remove html output fix code block --- .../_templates/template-tutorial.adoc | 1 + ...-bearer-token-authentication-tutorial.adoc | 23 +++++++++---------- ...idc-code-flow-authentication-tutorial.adoc | 22 +++++++++++------- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/docs/src/main/asciidoc/_templates/template-tutorial.adoc b/docs/src/main/asciidoc/_templates/template-tutorial.adoc index 04c03375965907..ea3a1a86db3983 100644 --- a/docs/src/main/asciidoc/_templates/template-tutorial.adoc +++ b/docs/src/main/asciidoc/_templates/template-tutorial.adoc @@ -12,6 +12,7 @@ TODO: [id="..."] = Title using sentence capitalization include::_attributes.adoc[] +:numbered: :diataxis-type: tutorial :categories: ... //// diff --git a/docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc b/docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc index 79b64542b456dd..614e7e70319a8f 100644 --- a/docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc +++ b/docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc @@ -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 @@ -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: @@ -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: @@ -84,7 +85,6 @@ The following configuration gets added to your build file: * Using Maven (pom.xml): + ==== --- [source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"] ---- @@ -92,7 +92,6 @@ The following configuration gets added to your build file: quarkus-oidc ---- --- ==== + * Using Gradle (build.gradle): @@ -106,7 +105,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: + @@ -185,7 +184,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. + @@ -215,7 +214,7 @@ For more information, see the <> 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. @@ -255,7 +254,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: + @@ -273,7 +272,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. @@ -291,7 +290,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. This implies that you no longer need to install a JVM on your production environment. @@ -314,7 +313,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 <> section. diff --git a/docs/src/main/asciidoc/security-oidc-code-flow-authentication-tutorial.adoc b/docs/src/main/asciidoc/security-oidc-code-flow-authentication-tutorial.adoc index 9ae22c5fe98e39..0acba645b1cea8 100644 --- a/docs/src/main/asciidoc/security-oidc-code-flow-authentication-tutorial.adoc +++ b/docs/src/main/asciidoc/security-oidc-code-flow-authentication-tutorial.adoc @@ -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 @@ -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: @@ -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: @@ -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: @@ -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 <> 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. @@ -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: @@ -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: @@ -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. @@ -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: @@ -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 <> section. +:sectnums!: + == Summary Congratulations!