Skip to content

Commit

Permalink
4.x Add missing dependencies from OIDC guides (#9478)
Browse files Browse the repository at this point in the history
  • Loading branch information
tvallin authored Nov 13, 2024
1 parent 831cc18 commit 58e644a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
6 changes: 5 additions & 1 deletion docs/src/main/asciidoc/mp/guides/security-oidc.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,12 @@ cd helidon-quickstart-mp
Update the pom.xml file and add the following Helidon dependency to the `<dependencies>` section.
[source,xml]
.Add the following dependency to `pom.xml`:
.Add the following dependencies to `pom.xml`:
----
<dependency>
<groupId>io.helidon.microprofile</groupId>
<artifactId>helidon-microprofile-security</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.microprofile</groupId>
<artifactId>helidon-microprofile-oidc</artifactId>
Expand Down
16 changes: 15 additions & 1 deletion docs/src/main/asciidoc/se/guides/security-oidc.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,28 @@ cd helidon-quickstart-se
Update the pom.xml file and add the following Helidon dependency to the `<dependencies>` section.
[source,xml]
.Add the following dependency to `pom.xml`:
.Add the following dependencies to `pom.xml`:
----
<dependency>
<groupId>io.helidon.webserver</groupId>
<artifactId>helidon-webserver-security</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.security.providers</groupId>
<artifactId>helidon-security-providers-oidc</artifactId>
</dependency>
----
[source,xml]
.Remove the `test` scope from `helidon-webclient` dependency
----
<dependency>
<groupId>io.helidon.webclient</groupId>
<artifactId>helidon-webclient</artifactId>
<scope>test</scope> <!-- remove this line -->
</dependency>
----
=== Add OIDC Security Properties
The OIDC security provider configuration can be joined to helidon configuration file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
class SecurityOidcSnippets {

// stub
static GreetingMessage createResponse(String str) {
static Message createResponse(String str) {
return null;
}

// stub
record GreetingMessage() {
record Message() {
String getMessage() {
return "";
}
Expand All @@ -51,7 +51,7 @@ String getMessage() {
@Authenticated
@GET
@Produces(MediaType.APPLICATION_JSON)
public GreetingMessage getDefaultMessage() {
public Message getDefaultMessage() {
return createResponse("World");
}
// end::snippet_1[]
Expand All @@ -76,11 +76,11 @@ void snippet_5(WebTarget target) {
void snippet_6(WebTarget target) {
// tag::snippet_4[]
String encoding = Base64.getEncoder().encodeToString("jack:changeit".getBytes());
GreetingMessage jsonMessage = target
Message jsonMessage = target
.path("greet")
.request()
.header(HttpHeaders.AUTHORIZATION, "Basic " + encoding)
.get(GreetingMessage.class);
.get(Message.class);

assertThat(jsonMessage.getMessage(), is("Hello World!"));
// end::snippet_4[]
Expand Down

0 comments on commit 58e644a

Please sign in to comment.