-
Notifications
You must be signed in to change notification settings - Fork 4
Add support for simple auth + account generation #7
Conversation
Signed-off-by: nkramer44 <[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.
LGTM -- some minor questions and suggestions, but nothing that should block a merge. Feel free to create issues for any of my comments, or fix them and I can re-approve.
/** | ||
* Jackson deserializer for {@link PaymentPointer}. | ||
*/ | ||
public class PaymentPointerDeserializer extends StdDeserializer<PaymentPointer> { |
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.
This is fine to be located here for now, but we should put this into Quilt since payment pointer lives there.
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.
See #9
src/main/java/org/interledger/spsp/server/grpc/services/AccountRequestResponseConverter.java
Outdated
Show resolved
Hide resolved
src/test/java/org/interledger/spsp/server/grpc/AccountGrpcHandlerTests.java
Outdated
Show resolved
Hide resolved
src/test/java/org/interledger/spsp/server/grpc/AccountGrpcHandlerTests.java
Show resolved
Hide resolved
src/test/java/org/interledger/spsp/server/grpc/AccountGrpcHandlerTests.java
Show resolved
Hide resolved
Optional<String> credentials = maybeAuthToken.toString().isEmpty() ? | ||
Optional.empty() : Optional.of(maybeAuthToken.toString()); | ||
|
||
AccountSettings accountSettings = newAccountService.createAccount(credentials, createAccountRequest); |
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.
This and the lines above it could be rewritten a bit more concisely as:
newAccountService.createAccount(authToken.map(t -> t.substring(t.indexOf(" ") + 1), createAccountRequest)
The authToken.map
should return what you want or an empty optional.
|
||
// Create account on the connector | ||
AccountSettings returnedAccountSettings = newAccountService.createAccount(request); | ||
AccountSettings returnedAccountSettings = newAccountService.createAccount(credentials, request); |
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.
Same here as with the last optional. It may be helpful to encapsulate this behavior in a class somewhere.
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.
Looks snazzy 👍
Just the opportunity to refactor the auth token logic and make it a little more concise, but looks great overall. Really nice job!
This PR aims to provide developers with an easier way to interact with Xpring's ILP infrastructure.
Developers can now create an account through Hermes, which will generate both an account id as well as a
AuthType.SIMPLE
auth token, and pass the unencrypted auth token back after the account has been created on the connector. Developers can simply send a POST request to Hermes/accounts
and will no longer have to create an account through Hermes using a JWT.Developers also have the ability to specify their own simple auth token, which allows for a greater breadth of auth providers at the application level.
All account-related endpoints will also now return a payment pointer, based on the SPSP url of the receiver that is currently wired up.
These changes shouldn't break any existing ILP wallet functionality, as Hermes still supports JWT passthrough, and all response object modifications were additive.