Skip to content

Commit

Permalink
Merge pull request #1395 from virtualcell/1375-auth0-request-focus
Browse files Browse the repository at this point in the history
request focus for VCell client after OIDC login/logout
  • Loading branch information
jcschaff authored Dec 9, 2024
2 parents 7578b6a + 1e20d4a commit 275e828
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -499,10 +499,19 @@ public void logOut(){
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
try {
Desktop.getDesktop().browse(URI.create("https://dev-dzhx7i2db3x3kkvq.us.auth0.com/oidc/logout"));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
if (Desktop.getDesktop().isSupported(Desktop.Action.APP_REQUEST_FOREGROUND)) {
try {
Desktop.getDesktop().requestForeground(true);
} catch (Exception e) {
lg.error("requestForeground failed", e);
}
} else {
lg.warn("APP_REQUEST_FOREGROUND not supported");
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}

public String getVCellUserNameFromAuth0Mapping() throws ApiException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,19 @@ public static AuthApiClient login(String clientID, URI authServerUri, URI apiBas
// set up web server to receive redirect and send URL to system browser - will be redirected back to http://localhost:9999/oidc_test_callback
System.out.println("launched browser with login window, will intercept the authentication response sent to local web server");
authorizationResponse = getAuthorizationResponseAutomated(localHttpServerPort, callback_endpoint_path, authRequestURI, successRedirectURI);
if (authorizationResponse != null) {
if (Desktop.getDesktop().isSupported(Desktop.Action.APP_REQUEST_FOREGROUND)) {
System.out.println("requesting foreground");
try {
Desktop.getDesktop().requestForeground(true);
System.out.println("foreground requested");
} catch (Exception e) {
System.err.println("failed to request foreground: " + e.getMessage());
}
} else {
System.err.println("foreground not supported");
}
}
} else {
// manual copy/paste of redirect URL into browser, and copy/paste of redirect URL back into console
authorizationResponse = getAuthorizationResponseManual(authRequestURI);
Expand Down

0 comments on commit 275e828

Please sign in to comment.