Move SignInWithEthereumEmbeddedExample to code-examples in documentation

Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
This commit is contained in:
Lachlan Roberts 2024-08-21 12:04:37 +10:00
parent cc61f783c4
commit a525b70c62
No known key found for this signature in database
GPG Key ID: 5663FB7A8FF7E348
4 changed files with 10 additions and 3 deletions

View File

@ -117,6 +117,10 @@
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>jetty-websocket-jetty-server</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-slf4j-impl</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.security.siwe.example;
package org.eclipse.jetty.docs.programming.security.siwe;
import java.io.PrintWriter;
import java.nio.file.Paths;
@ -43,8 +43,9 @@ public class SignInWithEthereumEmbeddedExample
server.addConnector(connector);
String resourcePath = Paths.get(Objects.requireNonNull(SignInWithEthereumEmbeddedExample.class.getClassLoader().getResource("")).toURI())
.resolve("../../src/test/resources/")
.resolve("../../src/main/resources/")
.normalize().toString();
System.err.println(resourcePath);
ResourceHandler resourceHandler = new ResourceHandler();
resourceHandler.setDirAllowed(false);
resourceHandler.setBaseResourceAsString(resourcePath);
@ -94,6 +95,7 @@ public class SignInWithEthereumEmbeddedExample
public static SecurityHandler createSecurityHandler(Handler handler)
{
// tag::configureSecurityHandler[]
// This uses jetty-core, but you can configure a ConstraintSecurityHandler for use with EE10.
SecurityHandler.PathMapped securityHandler = new SecurityHandler.PathMapped();
securityHandler.setHandler(handler);
@ -108,6 +110,7 @@ public class SignInWithEthereumEmbeddedExample
// Or you can configure with parameters on the SecurityHandler.
securityHandler.setParameter(EthereumAuthenticator.LOGIN_PATH_PARAM, "/login.html");
// end::configureSecurityHandler[]
return securityHandler;
}

View File

@ -119,7 +119,7 @@ The nonce endpoint provided by the `EthereumAuthenticator` returns a response wi
=== Configuring Security Handler
[,java,indent=0]
----
include::code:example$src/main/java/org/eclipse/jetty/docs/programming/security/siwe/SignInWithEthereum.java[tags=configureSecurityHandler]
include::code:example$src/main/java/org/eclipse/jetty/docs/programming/security/siwe/SignInWithEthereumEmbeddedExample.java[tags=configureSecurityHandler]
----
=== Login Page Example