-
Notifications
You must be signed in to change notification settings - Fork 27
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 Namespace Management CLI Commands #14
Conversation
This commit adds several new commands to the CLI for managing namespaces. The commands added include: - Register a new namespace - Delete a namespace - List all namespaces - Get a specific namespace This commit also adds the necessary flag definitions and configurations for each command. In addition, the commit includes the implementation of JWT-based authentication when registering a namespace. This includes handling of JSON Web Key Sets (JWKS), signing/verification of payloads, nonce generation, and HTTP request/response handling. The code also includes functions for loading and saving signatures to/from a file, and for loading ECDSA public/private keys from PEM and JWKS formats.
- Checked error returns from 'viper.BindPFlag' calls for robust error handling. - Commented out unused functions 'writeSignatureToFile', 'loadSignatureFromFile', 'verifySignature' to prevent 'unused' linting errors. - Utilized the err variable after client.Do(req) call to prevent ineffectual assignment.
…ust error handling.
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.
A few cleanup items requested; comments are inline.
The big picture item is to switch to using the JWT library that's already used in the client. See:
https://github.com/PelicanPlatform/pelican/blob/main/origin_ui/origin.go#L148-L165
That should actually decrease the size of the PR quite a bit.
2. clean code 3. avoid panic'ing within the CLI
…erver_creds.go now also takes a curve argument as input
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.
A few review comments - but given we're short on time I'll merge anyway:
- Better to unmarshal into
struct
s instead ofmap[string]interface{}
; that will ensure the expected keys are present. - Elsewhere in the code, we've been using CamelCase instead of underscores.
- I suspect there's a better way to handle the JWKS serialization besides converting it to a map. A follow-up might be to dig through the
jwk
library to see if there's some serialization routines we can reuse from there.
This commit adds several new commands to the CLI for managing namespaces. The commands added include:
In addition, the commit includes the implementation of JWT-based authentication when registering a namespace. This includes handling of JSON Web Key Sets (JWKS), signing/verification of payloads, nonce generation, and HTTP request/response handling.
The code also includes functions for loading and saving signatures to/from a file, and for loading ECDSA public/private keys from PEM and JWKS formats.