Changeset 38258 for main/trunk/gli/src


Ignore:
Timestamp:
2023-09-30T21:32:17+13:00 (9 months ago)
Author:
anupama
Message:

I think I have webswing gli authentication working out without an authentication popup when the user is also logged in through greenstone, without breaking existing functionality. I still can't work out why the WebswingAuthenticator has static members and yet a proper constructor is called. This commit contains debug statements. Added a webswing javascript function that Java can call for debugging statements going into the browser's console using console.log, called jsConsoleLog.

Location:
main/trunk/gli/src/org/greenstone/gatherer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r38256 r38258  
    250250        }
    251251        else if (isWebswing) {
     252
     253           
    252254            Configuration.template_config_xml = Configuration.TEMPLATE_CONFIG_PREFIX +  Configuration.CONFIG_WEBSWING_XML;
    253255            Configuration.config_xml = Configuration.CONFIG_WEBSWING_XML;
    254256
     257            String webswing_msg = "username: " + go.username +
     258            "\ngroups: " + go.usergroups +
     259            "\nuid: " + go.userJSessionID;
    255260           
    256             if(go.userJSessionID != null) {
     261            JOptionPane.showMessageDialog(null, webswing_msg, "webswing info", JOptionPane.INFORMATION_MESSAGE);
     262            /*
     263              try {
     264              Thread.sleep(5000);
     265              } catch(Exception e) {
     266              System.err.println("Couldn't sleep for 5000 ms");
     267              }*/
     268           
     269            if(go.username != null && !go.username.equals("")
     270               && go.userJSessionID != null && !go.userJSessionID.equals("")) {
     271           
     272           
    257273            webswingAuthenticator = new WebswingAuthenticator(go.username, go.usergroups, go.userJSessionID);
     274            } else { //if(webswingAuthenticator != null) {
     275            WebswingAuthenticator.clear();
     276            if(webswingAuthenticator != null) {
     277                webswingAuthenticator = null;
     278            }
    258279            }
     280           
    259281        }
    260282        else {     
     
    21212143        extends GAuthenticator
    21222144    {
    2123         static protected String username;
     2145        static protected String username = null;
    21242146        static protected HashSet<String> groups;
    21252147        static protected String userJSessionID;
    21262148        static protected String rawgroups;
     2149
     2150        static public void clear() {
     2151        username = null;
     2152        groups = null;
     2153        userJSessionID = null;
     2154        rawgroups = null;
     2155        }
    21272156
    21282157        protected void displayError(String error_message) {
     
    21482177
    21492178        public boolean authenticate(String library_url_string) {
    2150           if(username == null) {
     2179        String result;
     2180        if(username == null) {
    21512181        PasswordAuthentication pa = getPasswordAuthentication();
    21522182        if (pa == null) {
     
    21602190       
    21612191        String password = new String(pa.getPassword());
    2162         String result;
     2192
    21632193        try {
    21642194            String new_url = library_url_string+"?a=s&sa=authenticated-ping&excerptid=gs_content&un="+username+"&pw="+password;
  • main/trunk/gli/src/org/greenstone/gatherer/GathererProg.java

    r37677 r38258  
    3131import javax.swing.*;
    3232import org.greenstone.gatherer.util.Utility;
     33import org.webswing.toolkit.api.WebswingUtil;
     34import java.util.Arrays;
    3335
    3436/**
     
    6769    String gli_user_directory_path = null;
    6870    if (go.webswing) {
     71        WebswingUtil.getWebswingApi().sendActionEvent("jsConsoleLog", "args are: " + Arrays.toString(args), null);
     72       
    6973        if (go.gsdl3_src_path != null) {
    7074        // above is a (albeit a crude) test at this early stage of running,
Note: See TracChangeset for help on using the changeset viewer.