Skip to content

Feature - API Token Management UI#613

Merged
bedanley merged 11 commits into
developfrom
feature/api-tokens
Dec 17, 2025
Merged

Feature - API Token Management UI#613
bedanley merged 11 commits into
developfrom
feature/api-tokens

Conversation

@jmharold
Copy link
Copy Markdown
Contributor

Description of changes:

  • Added Admin UI for API token management. From this UI admins can:
    • View all configured API tokens (current status and related metadata)
    • Create / Delete tokens for users / system users
  • Added LISA configuration option ("Allow user managed API tokens") for enabling and disabling LISA user's ability to create and delete their own tokens.
  • Added User UI for API token management (if enabled by admin via configuration page). From this page users can:
    • Create, view, delete their own token (1 token per user limit in current implementation)
    • Admins can also navigate to this page if they want to manage their own token
  • Added new APIs for managing the lifecycle of API tokens for customers who do not have the UI deployed.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

image Screenshot 2025-12-12 at 4 05 41 PM Screenshot 2025-12-10 at 4 13 14 PM image image

expiration = request.tokenExpiration or int((datetime.now() + timedelta(days=90)).timestamp())

# Store in DynamoDB
item = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should have a pydantic model that sets the default values if one isn't provided.

Comment thread lambda/api_tokens/lambda_functions.py Outdated

event = request.scope["aws.event"]
current_user = get_username(event)
is_admin_user = is_admin(event)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can try the admin_only annotation

Comment thread lambda/api_tokens/lambda_functions.py Outdated

event = request.scope["aws.event"]
current_user = get_username(event)
is_admin_user = is_admin(event)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also the get_user_context(), which returns both the username and is_admin tuple

Comment thread lambda/authorizer/lambda_functions.py Outdated
token_info = is_valid_api_token(id_token)
if token_info:
# Use actual values from token
# TODO: Remove default api-token.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have default api-tokens? Not the management key.

const paginatedTokens = filteredTokens.slice(startIndex, startIndex + preferences.pageSize);

const formatDate = (timestamp: number) => {
return new Date(timestamp * 1000).toLocaleString();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we create the value correctly in the backend?

bedanley
bedanley previously approved these changes Dec 17, 2025
@bedanley bedanley merged commit 2d6f5c2 into develop Dec 17, 2025
7 of 10 checks passed
@bedanley bedanley deleted the feature/api-tokens branch December 17, 2025 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants