-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add command for adding secret authentication for security realm. #82
Conversation
@@ -0,0 +1,89 @@ | |||
package org.wildfly.extras.creaper.commands.security.realms; | |||
|
|||
|
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.
Oh come on :-)
Now thinking about the Base64 class -- we already depend on Guava and Guava has an implementation. So please use that. |
Thank you for objections. Issues are fixed. |
} | ||
|
||
/** | ||
* {@link BaseEncoding#base64()} will be used. |
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.
How about saying This method will encode the provided {@code password} using Base64.
?
OK, looks good. Please address the remaining comments and squash. |
Done. |
ModelNodeResult result = ops.readAttribute(TEST_SECRET_IDENTITY_ADDRESS, "value"); | ||
result.assertSuccess(); | ||
assertEquals("Password should be encoded properly.", | ||
PASSWORD, new String(BaseEncoding.base64().decode(result.stringValue()))); |
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.
Never ever do new String(byte[])
, that uses the default charset. Please use new String(byte[], String|Charset)
.
Sorry for not noticing it earlier. |
* This method will encode the provided {@code password} using Base64 | ||
*/ | ||
public Builder password(String password) throws IOException { | ||
this.password = BaseEncoding.base64().encode(password.getBytes("UTF-8")); |
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.
One more thing: I think it should be documented that we're using UTF-8 here. Something like: For the purpose of the Base64 encoding, the {@code password} is treated as a sequence of bytes in the UTF-8 encoding.
Later, we could add an overload where one can specify the encoding themselves, but we don't need that now.
Done. |
OK, merged, thanks! |
fix: correct order of removing resources (because of capability)
No description provided.