Skip to content
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

Made audience optional in the CLI #57

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

## v2.0.3 - 2024-10-10

- Made audience optional in cli

## v2.0.2 - 2024-10-05

- Added support for pytest 8

## v2.0.1 - 2024-05-29

- Restored optional TokenPayload fields.
Expand Down
3 changes: 1 addition & 2 deletions armasec_cli/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,14 @@ def refresh_access_token(ctx: CliContext, token_set: TokenSet):

If refresh fails, notify the user that they need to log in again.
"""
print("MAKE THIS FUCKING THING USE THE BASE URL")
url = "/protocol/openid-connect/token"
logger.debug(f"Requesting refreshed access token from {url}")

refreshed_token_set: TokenSet = cast(
TokenSet,
make_request(
ctx.client,
"/protocol/openid-connect/token",
url,
"POST",
abort_message="The auth token could not be refreshed. Please try logging in again.",
abort_subject="EXPIRED ACCESS TOKEN",
Expand Down
3 changes: 2 additions & 1 deletion armasec_cli/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
from functools import wraps
from pathlib import Path
from typing import Optional

import snick
import typer
Expand All @@ -21,7 +22,7 @@ class OidcProvider(AutoNameEnum):

class Settings(BaseModel):
oidc_domain: str
oidc_audience: str
oidc_audience: Optional[str] = None
oidc_client_id: str
oidc_use_https: bool = True
oidc_max_poll_time: int = 5 * 60 # 5 minutes
Expand Down
2 changes: 1 addition & 1 deletion armasec_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def logout():
def set_config(
domain: str = typer.Option(..., help="The domain used by your OIDC provider"),
audience: str = typer.Option(
...,
None,
help="The audience required by your OIDC provider",
),
client_id: str = typer.Option(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "armasec"
version = "2.0.2"
version = "2.0.3"
description = "Injectable FastAPI auth via OIDC"
authors = ["Omnivector Engineering Team <[email protected]>"]
license = "MIT"
Expand Down
Loading