Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.x Add missing dependencies from OIDC guides #9478

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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