Skip to content

Commit

Permalink
[patch] Tidy up SSO interactive mode prompts (#1132)
Browse files Browse the repository at this point in the history
  • Loading branch information
durera authored Jul 22, 2024
1 parent dd6e1d4 commit 300d693
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion python/src/mas-cli
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ if __name__ == '__main__':
except KeyboardInterrupt as e:
pass
except ApiException as e:
app.fatalError(message=f"An error occured communicating with the target server: {e.reason} ({e.status})")
app.fatalError(message=f"An error occured communicating with the target server: {e.reason} ({e.status})", exception=e)
except MaxRetryError as e:
app.fatalError(message="Unable to connect to API server", exception=e)
except TemplateNotFound as e:
Expand Down
4 changes: 3 additions & 1 deletion python/src/mas/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,10 @@ def connect(self):
# We are already connected to a cluster, but prompt the user if they want to use this connection
continueWithExistingCluster = prompt(HTML('<Yellow>Proceed with this cluster?</Yellow> '), validator=YesNoValidator(), validate_while_typing=False)
promptForNewServer = continueWithExistingCluster in ["n", "no"]
except Exception:
except Exception as e:
# We are already connected to a cluster, but the connection is not valid so prompt for connection details
logger.debug("Failed looking up OpenShift Console route to verify connection")
logger.exception(e, stack_info=True)
promptForNewServer = True
else:
# We are not already connected to any cluster, so prompt for connection details
Expand Down
21 changes: 11 additions & 10 deletions python/src/mas/cli/install/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,16 @@ def configCP4D(self):
self.deployCP4D = True

def configSSOProperties(self):
self.printH2("Configure Single Sign-On (SSO) Default Properties")
sso_response = self.yesOrNo("Would you like to configure default SSO properties?")
if not sso_response:
self.printDescription([
"Using default SSO properties"
])
else:
self.promptForInt("Enter the idleTimeout (in seconds)", "idle_timeout", default=1800)
self.printH1("Single Sign-On (SSO)")
self.printDescription([
"Many aspects of Maximo Application Suite's Single Sign-On (SSO) can be customized:",
" - Idle session automatic logout timer",
" - Session, access token, and refresh token timeouts",
" - Default identity provider (IDP), and seamless login"
])
sso_response = self.yesOrNo("Configure SSO properties")
if sso_response:
self.promptForInt("Enter the idle timeout (in seconds)", "idle_timeout", default=1800)
self.promptForString("Enter the IDP session timeout (e.g., '12h' for 12 hours)", "idp_session_timeout", validator=TimeoutFormatValidator(), default="12h")
self.promptForString("Enter the access token timeout (e.g., '30m' for 30 minutes)", "access_token_timeout", validator=TimeoutFormatValidator(), default="30m")
self.promptForString("Enter the refresh token timeout (e.g., '12h' for 12 hours)", "refresh_token_timeout", validator=TimeoutFormatValidator(), default="12h")
Expand Down Expand Up @@ -239,6 +241,7 @@ def configMAS(self):
self.configOperationMode()
self.configCATrust()
self.configDNSAndCerts()
self.configSSOProperties()

def configCATrust(self) -> None:
self.printH1("Certificate Authority Trust")
Expand Down Expand Up @@ -537,8 +540,6 @@ def interactiveMode(self) -> None:
# Interactive mode
self.interactiveMode = True

# SSO Config
self.configSSOProperties()
# Catalog
self.configCatalog()
if not self.devMode:
Expand Down

0 comments on commit 300d693

Please sign in to comment.