Add REST API key endpoints and bootstrap endpoint (issue #207)#209
Open
stalep wants to merge 1 commit into
Open
Add REST API key endpoints and bootstrap endpoint (issue #207)#209stalep wants to merge 1 commit into
stalep wants to merge 1 commit into
Conversation
barreiro
requested changes
Jul 17, 2026
barreiro
left a comment
Contributor
There was a problem hiding this comment.
this can be simplified to just the essential (create / list / revoke). see my comments.
| * | ||
| * @param description human-readable label for the key (e.g., "Jenkins CI", "local testing") | ||
| */ | ||
| public record ApiKeyRequest(String description) {} |
Contributor
There was a problem hiding this comment.
I acknowledge the use of a request object, but I don't think is needed in this case
stalep
force-pushed
the
issue_207_apikey_rest
branch
2 times, most recently
from
July 19, 2026 08:55
3815269 to
e43f62f
Compare
REST endpoints for API key management:
POST /api/apikey — create key for authenticated user (returns raw key as text/plain)
GET /api/apikey — list authenticated user's keys (List<ApiKey>)
PUT /api/apikey/{id}/revoke — revoke a key (ownership check: must own key or be admin)
Startup bootstrap for automated environments:
Set h5m.bootstrap.api-key (or H5M_BOOTSTRAP_API_KEY env var) to a known
key value. On startup, if no users exist, BootstrapService creates an
admin user with an API key matching the configured value. Logs a warning
if the bootstrap user still exists on subsequent startups.
Entity rename: ApiKey -> ApiKeyEntity (consistent with FolderEntity,
NodeEntity, ValueEntity convention). The api.ApiKey record is now the
DTO returned by the REST endpoints.
New files:
- api/ApiKeyRequest.java — request DTO (description field)
- api/ApiKey.java — response DTO (id, description, dates, status)
- rest/ApiKeyResource.java — API key CRUD endpoints
- svc/BootstrapService.java — startup bootstrap with configurable API key
- svc/ApiKeyService.createWithKey() — create key with specific raw value
stalep
force-pushed
the
issue_207_apikey_rest
branch
from
July 19, 2026 11:56
e43f62f to
30a7929
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New REST endpoints for API key management:
POST /api/apikey — create key for authenticated user (returns raw key as text/plain)
GET /api/apikey — list authenticated user's keys
PUT /api/apikey/{id}/revoke — revoke a key (ownership check: must own key or be admin)
Bootstrap endpoint for first-time setup:
POST /api/bootstrap — creates admin user + API key when no users exist
Returns BootstrapResponse with username and raw key
Returns 409 if any user already exists
This enables external clients (Jenkins plugin, CI/CD tools) to:
New files: