-
Notifications
You must be signed in to change notification settings - Fork 9
Add user private keys management commands: add, delete #304
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 user private keys management commands: add, delete #304
Conversation
cmd/aem/user.go
Outdated
| func (c *CLI) KeystoreKeyAdd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: "add", | ||
| Short: "Create user Keystore key", |
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.
"masło maślane" a bit :)
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.
do not mix upper case with lowercase; make it looking elegant / consistent
cmd/aem/user.go
Outdated
| return | ||
| } | ||
|
|
||
| changed, err := instance.Auth().UserManager().DeleteKeystoreKey( |
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.
commands are scoped so keystore keys should be also scoped
UserManager().Keystore().DeleteKey() ?
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.
ok
pkg/user_manager.go
Outdated
| return UsersPath + "/" + scope + "/" + id | ||
| } | ||
|
|
||
| func readKeyStore(filename string, password []byte) (*jks.KeyStore, error) { |
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 are we reading this?
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.
Because what we get from AEM when something is wrong with the keystore is a 500 response with HTML document. I wanted to check the keystore locally so we get more info rather than parsing the response.
pkg/user_manager.go
Outdated
| } | ||
|
|
||
| if status == nil || !status.Created { | ||
| return false, fmt.Errorf("%s > cannot add keystore key: keystore does not exist", um.instance.IDColor()) |
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.
cannot add keystore key as keystore does not exist ? ( i mean merge msg)
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.
ok
pkg/user_manager.go
Outdated
| "keyStore": keystoreFilePath, | ||
| } | ||
|
|
||
| keystorePath := assembleUserPath(scope, id) + ".ks.html" |
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.
composeUserPath
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.
stubborn 😉
cmd/aem/user.go
Outdated
| cmd := &cobra.Command{ | ||
| Use: "status", | ||
| Short: "Get status of keystore", | ||
| Short: "Get status of a user's keystore", |
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.
just user keystore ? :)
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.
ok
cmd/aem/user.go
Outdated
| func (c *CLI) userKeyAdd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: "add", | ||
| Short: "Add user's private key to their keystore", |
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.
just user private key
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.
ok
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.
keystore/{keystore_status => status}.go
pkg/keystore_manager.go
Outdated
| } | ||
|
|
||
| func (km *KeystoreManager) Status(scope, id string) (*keystore.Status, error) { | ||
| userKeystorePath := composeUserPath(scope, id) + ".ks.json" |
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.
you are appending ".ks.json" here and on line 52 as well ; extract same func or sth
…e readKeyStore function
Uh oh!
There was an error while loading. Please reload this page.