1919@click .option ("-e" , "--endpoint" , type = str , help = "Enter the Jumpstarter service endpoint." , default = None )
2020@click .option ("--namespace" , type = str , help = "Enter the Jumpstarter exporter namespace." , default = None )
2121@click .option ("--name" , type = str , help = "Enter the Jumpstarter exporter name." , default = None )
22+ @click .option (
23+ "--force" ,
24+ is_flag = True ,
25+ help = "Force fresh login" ,
26+ default = False ,
27+ )
2228@opt_oidc
2329# client specific
2430# TODO: warn if used with exporter
@@ -52,6 +58,7 @@ async def login( # noqa: C901
5258 insecure_tls_config : bool ,
5359 nointeractive : bool ,
5460 allow ,
61+ force : bool ,
5562):
5663 """Login into a jumpstarter instance"""
5764
@@ -124,7 +131,8 @@ async def login( # noqa: C901
124131 elif username is not None and password is not None :
125132 tokens = await oidc .password_grant (username , password )
126133 else :
127- tokens = await oidc .authorization_code_grant (callback_port = callback_port )
134+ prompt = "login" if force else None
135+ tokens = await oidc .authorization_code_grant (callback_port = callback_port , prompt = prompt )
128136
129137 config .token = tokens ["access_token" ]
130138
@@ -138,10 +146,11 @@ async def login( # noqa: C901
138146 case "exporter_config" :
139147 ExporterConfigV1Alpha1 .save (config , value ) # ty: ignore[invalid-argument-type]
140148
149+
141150@blocking
142151async def relogin_client (config : ClientConfigV1Alpha1 ):
143152 """Relogin into a jumpstarter instance"""
144- client_id = "jumpstarter-cli" # TODO: store this metadata in the config
153+ client_id = "jumpstarter-cli" # TODO: store this metadata in the config
145154 try :
146155 issuer = decode_jwt_issuer (config .token )
147156 except Exception as e :
@@ -151,7 +160,6 @@ async def relogin_client(config: ClientConfigV1Alpha1):
151160 oidc = Config (issuer = issuer , client_id = client_id )
152161 tokens = await oidc .authorization_code_grant ()
153162 config .token = tokens ["access_token" ]
154- ClientConfigV1Alpha1 .save (config ) # ty: ignore[invalid-argument-type]
163+ ClientConfigV1Alpha1 .save (config ) # ty: ignore[invalid-argument-type]
155164 except Exception as e :
156165 raise ReauthenticationFailed (f"Failed to re-authenticate: { e } " ) from e
157-
0 commit comments