Add user private keys management commands: add, delete#304
Add user private keys management commands: add, delete#304piotr-andruszkiewicz-wttech merged 11 commits intomainfrom
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.
"masło maślane" a bit :)
There was a problem hiding this comment.
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.
commands are scoped so keystore keys should be also scoped
UserManager().Keystore().DeleteKey() ?
There was a problem hiding this comment.
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.
why are we reading this?
There was a problem hiding this comment.
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.
cannot add keystore key as keystore does not exist ? ( i mean merge msg)
There was a problem hiding this comment.
ok
pkg/user_manager.go
Outdated
| "keyStore": keystoreFilePath, | ||
| } | ||
|
|
||
| keystorePath := assembleUserPath(scope, id) + ".ks.html" |
There was a problem hiding this comment.
composeUserPath
There was a problem hiding this comment.
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.
just user keystore ? :)
There was a problem hiding this comment.
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.
just user private key
There was a problem hiding this comment.
ok
There was a problem hiding this comment.
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.
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.