Move SignInWithEthereumEmbeddedExample to code-examples in documentation
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
This commit is contained in:
parent
cc61f783c4
commit
a525b70c62
|
@ -117,6 +117,10 @@
|
||||||
<groupId>org.eclipse.jetty.websocket</groupId>
|
<groupId>org.eclipse.jetty.websocket</groupId>
|
||||||
<artifactId>jetty-websocket-jetty-server</artifactId>
|
<artifactId>jetty-websocket-jetty-server</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
<artifactId>jetty-slf4j-impl</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -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.io.PrintWriter;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
@ -43,8 +43,9 @@ public class SignInWithEthereumEmbeddedExample
|
||||||
server.addConnector(connector);
|
server.addConnector(connector);
|
||||||
|
|
||||||
String resourcePath = Paths.get(Objects.requireNonNull(SignInWithEthereumEmbeddedExample.class.getClassLoader().getResource("")).toURI())
|
String resourcePath = Paths.get(Objects.requireNonNull(SignInWithEthereumEmbeddedExample.class.getClassLoader().getResource("")).toURI())
|
||||||
.resolve("../../src/test/resources/")
|
.resolve("../../src/main/resources/")
|
||||||
.normalize().toString();
|
.normalize().toString();
|
||||||
|
System.err.println(resourcePath);
|
||||||
ResourceHandler resourceHandler = new ResourceHandler();
|
ResourceHandler resourceHandler = new ResourceHandler();
|
||||||
resourceHandler.setDirAllowed(false);
|
resourceHandler.setDirAllowed(false);
|
||||||
resourceHandler.setBaseResourceAsString(resourcePath);
|
resourceHandler.setBaseResourceAsString(resourcePath);
|
||||||
|
@ -94,6 +95,7 @@ public class SignInWithEthereumEmbeddedExample
|
||||||
|
|
||||||
public static SecurityHandler createSecurityHandler(Handler handler)
|
public static SecurityHandler createSecurityHandler(Handler handler)
|
||||||
{
|
{
|
||||||
|
// tag::configureSecurityHandler[]
|
||||||
// This uses jetty-core, but you can configure a ConstraintSecurityHandler for use with EE10.
|
// This uses jetty-core, but you can configure a ConstraintSecurityHandler for use with EE10.
|
||||||
SecurityHandler.PathMapped securityHandler = new SecurityHandler.PathMapped();
|
SecurityHandler.PathMapped securityHandler = new SecurityHandler.PathMapped();
|
||||||
securityHandler.setHandler(handler);
|
securityHandler.setHandler(handler);
|
||||||
|
@ -108,6 +110,7 @@ public class SignInWithEthereumEmbeddedExample
|
||||||
|
|
||||||
// Or you can configure with parameters on the SecurityHandler.
|
// Or you can configure with parameters on the SecurityHandler.
|
||||||
securityHandler.setParameter(EthereumAuthenticator.LOGIN_PATH_PARAM, "/login.html");
|
securityHandler.setParameter(EthereumAuthenticator.LOGIN_PATH_PARAM, "/login.html");
|
||||||
|
// end::configureSecurityHandler[]
|
||||||
|
|
||||||
return securityHandler;
|
return securityHandler;
|
||||||
}
|
}
|
|
@ -119,7 +119,7 @@ The nonce endpoint provided by the `EthereumAuthenticator` returns a response wi
|
||||||
=== Configuring Security Handler
|
=== Configuring Security Handler
|
||||||
[,java,indent=0]
|
[,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
|
=== Login Page Example
|
||||||
|
|
Loading…
Reference in New Issue