-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Issue #11560 - Implement EIP-4361 Sign-In With Ethereum #11883
Conversation
This is ready for early reviews as the implementation is complete. To test this yourself you can install MetaMask browser extension and run TODOs:
|
Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use LOG.warn()
especially if you can default the value.
Also, try to make all classes internal if possible, and leave exported only those that are strictly necessary.
If possible, make it asynchronous.
I would prefer to avoid that half-sent messages to block threads for the whole idle timeout.
jetty-core/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/AnyUserLoginService.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/EthereumAuthenticator.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/EthereumAuthenticator.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/EthereumAuthenticator.java
Outdated
Show resolved
Hide resolved
...y-core/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/SignInWithEthereumToken.java
Outdated
Show resolved
Hide resolved
...y-core/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/SignInWithEthereumToken.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/SignedMessage.java
Outdated
Show resolved
Hide resolved
...-core/jetty-siwe/src/test/java/org/eclipse/jetty/security/siwe/util/EthereumCredentials.java
Show resolved
Hide resolved
...tty-siwe/src/test/java/org/eclipse/jetty/security/siwe/util/SignInWithEthereumGenerator.java
Show resolved
Hide resolved
Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to do some doco as part of this pr too ;)
jetty-core/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/EthereumAuthenticator.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/EthereumAuthenticator.java
Show resolved
Hide resolved
...e/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/internal/AnyUserLoginService.java
Outdated
Show resolved
Hide resolved
...e/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/internal/AnyUserLoginService.java
Outdated
Show resolved
Hide resolved
...y-siwe/src/main/java/org/eclipse/jetty/security/siwe/internal/EthereumSignatureVerifier.java
Outdated
Show resolved
Hide resolved
...e/jetty-siwe/src/test/java/org/eclipse/jetty/security/siwe/SignInWithEthereumParserTest.java
Show resolved
Hide resolved
jetty-core/jetty-siwe/src/test/java/org/eclipse/jetty/security/siwe/SignInWithEthereumTest.java
Outdated
Show resolved
Hide resolved
...src/test/java/org/eclipse/jetty/security/siwe/example/SignInWithEthereumEmbeddedExample.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/EthereumAuthenticator.java
Show resolved
Hide resolved
jetty-core/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/EthereumAuthenticator.java
Show resolved
Hide resolved
Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
78403ec
to
436ca41
Compare
Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
@lachlan-roberts forced push????? what??!?!?!?!? Now I've lost all my review context! IMNSHO you should only ever force push when you've screwed up.... or put the other way, if I see a forced push I KNOW you've screwed up !)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly good, but the agro from the forced push is making me set a high bar for javadoc, formatting, naming and layout.!
jetty-core/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/SignedMessage.java
Outdated
Show resolved
Hide resolved
...y-siwe/src/main/java/org/eclipse/jetty/security/siwe/internal/EthereumSignatureVerifier.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/internal/EthereumUtil.java
Show resolved
Hide resolved
...ty-siwe/src/main/java/org/eclipse/jetty/security/siwe/internal/SignInWithEthereumParser.java
Outdated
Show resolved
Hide resolved
...tty-siwe/src/main/java/org/eclipse/jetty/security/siwe/internal/SignInWithEthereumToken.java
Show resolved
Hide resolved
...e/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/internal/AnyUserLoginService.java
Outdated
Show resolved
Hide resolved
...src/test/java/org/eclipse/jetty/security/siwe/example/SignInWithEthereumEmbeddedExample.java
Outdated
Show resolved
Hide resolved
...-core/jetty-siwe/src/test/java/org/eclipse/jetty/security/siwe/util/EthereumCredentials.java
Outdated
Show resolved
Hide resolved
...tty-siwe/src/test/java/org/eclipse/jetty/security/siwe/util/SignInWithEthereumGenerator.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Lachlan Roberts <[email protected]>
…SignInWithEthereum
Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
jetty-core/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/EthereumAuthenticator.java
Outdated
Show resolved
Hide resolved
@SuppressWarnings("unchecked") | ||
Set<String> attribute = (Set<String>)session.getAttribute(NONCE_SET_ATTR); | ||
if (attribute == null) | ||
session.setAttribute(NONCE_SET_ATTR, attribute = new FixedSizeSet<>(5)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need the FixedSizeSet
class? Isn't this just setting a single element?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably, but I've had issues with openId where multiple authentication requests come in from the browser and then one of them fails because the nonce is forgotten and causes the other ones to fail.
...src/test/java/org/eclipse/jetty/security/siwe/example/SignInWithEthereumEmbeddedExample.java
Outdated
Show resolved
Hide resolved
jetty-ee10/jetty-ee10-tests/jetty-ee10-test-siwe-webapp/src/main/webapp/login.html
Outdated
Show resolved
Hide resolved
...est-ee10-distribution/src/test/java/org/eclipse/jetty/ee10/tests/distribution/SiweTests.java
Show resolved
Hide resolved
...e/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/internal/AnyUserLoginService.java
Outdated
Show resolved
Hide resolved
...e/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/internal/AnyUserLoginService.java
Show resolved
Hide resolved
...e/jetty-siwe/src/main/java/org/eclipse/jetty/security/siwe/internal/AnyUserLoginService.java
Show resolved
Hide resolved
...ty-siwe/src/main/java/org/eclipse/jetty/security/siwe/internal/SignInWithEthereumParser.java
Outdated
Show resolved
Hide resolved
...tty-siwe/src/main/java/org/eclipse/jetty/security/siwe/internal/SignInWithEthereumToken.java
Show resolved
Hide resolved
...y-siwe/src/main/resources/META-INF/services/org.eclipse.jetty.security.Authenticator$Factory
Outdated
Show resolved
Hide resolved
Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
…SignInWithEthereum
…SignInWithEthereum
Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
|
||
= Jetty Security | ||
|
||
TODO: introduction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that TODO shown in the resulting documentation, or is it treated like a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shows the todo in the documentation, but the documentation is very incomplete and doesn't yet have any other security modules. And a bunch of the other main headers have the same TODOs for the introduction page.
But I will remove this index file and just have a header without an intro page for this.
Signed-off-by: Lachlan Roberts <[email protected]>
…SignInWithEthereum
replaced by #12188 |
Issue #11560
Add new Jetty module called
jetty-siwe
, which implements EIP4361 Sign-In With Ethereum via theEthereumAuthenticator
. This allows you to authenticate with a crypto wallet such as MetaMask.See https://eips.ethereum.org/EIPS/eip-4361