Closed HiromuHota closed 5 years ago
Workaround
StoredCredential
will be created at plugins/pentaho-googledrive-vfs/credentials
client_secret.json
and StoredCredential
from Spoon to webSpoon.GoogleAuthorizationDialog.java
violates one of the anti-pattern in webSpoon (ie https://github.com/HiromuHota/pentaho-kettle/wiki/Dev%3A-Antipatterns-in-webSpoon#example-use-of-the-static-modifier-for-session-unique-instances).
The following code fixes it.
$ git diff
diff --git a/plugins/pentaho-googledrive-vfs/core/src/main/java/org/pentaho/googledrive/vfs/ui/GoogleAuthorizationDialog.java b/plugins/pentaho-googledrive-vfs/core/src/main/java/org/pentaho/googledrive/vfs/ui/GoogleAuthorizationDialog.java
index e9f69bef0c..5f84983f5c 100644
--- a/plugins/pentaho-googledrive-vfs/core/src/main/java/org/pentaho/googledrive/vfs/ui/GoogleAuthorizationDialog.java
+++ b/plugins/pentaho-googledrive-vfs/core/src/main/java/org/pentaho/googledrive/vfs/ui/GoogleAuthorizationDialog.java
@@ -43,7 +43,7 @@ public class GoogleAuthorizationDialog extends Dialog {
protected Display display;
private static final int OPTIONS = SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM;
- private static final Image LOGO = GUIResource.getInstance().getImageLogoSmall();
+ private final Image LOGO = GUIResource.getInstance().getImageLogoSmall();
private VerificationCodeReceiver receiver;
public GoogleAuthorizationDialog( Shell shell, VerificationCodeReceiver receiver ) {
But now we can another problem.
The following error is shown at the browser's console,
Refused to display 'https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=500042598218-oj0mf6hb1nk2k3eq5qcrpmai7js3ovc5.apps.googleusercontent.com&redirect_uri=http://localhost:53544/Callback/success.html&response_type=code&scope=https://www.googleapis.com/auth/drive' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
This means that the Google page restricts itself from being embedded in an external page to prevent a clickjacking and most modern browsers respect 'X-Frame-Options'. This is not the case for Spoon because the Browser widget in SWT is not a modern browser, while the Browser widget in RWT is an iframe (see here for details) hence is restricted by the option.
b1ada947e90200e14157590f1d542f0c8ae90fab in branch fix/107
can solve the 'X-Frame-Options' issue.
But the current implementation (b1ada947e90200e14157590f1d542f0c8ae90fab) has a limitation that the host of the callback url is always 'localhost'.
I would not merge this branch because
Though I'm not merging it for now, I will put the branch in a public space in case someone may find it useful as-is or can submit a pull-request in a better shape.
Expected Behavior
A window pops up like this:
Actual Behavior
The window does not pop up, but the following error occurs.
Steps to Reproduce the Problem
As described in https://t.co/XylJLOoKjD
client_secret.json
toplugins/pentaho-googledrive-vfs/credentials
Specifications
Server