OpenNTF/SocialSDK

Missing SSOEndpoint for Sametime

Closed this issue · 5 comments

There is missing code for Sametime SSO login on Domino XPages. To be concrete - no SametimeSSOEndpoint and related code in SametimeClientRenderer (writeAutoLogin....)

We are going to look at this, but no promise of a fix.

fix would be simple.

  • add SametimeSSOEndpoint (with some small modifications its in my other question about HTTPS).
  • add methods to SametimeClientRenderer:
    protected void writeAutoLoginToken(FacesContext context, UIViewRootEx2 rootEx, UISametimeClient stClient, SSOEndpoint stServer) throws IOException {
        // TODO Auto-generated method stub

        boolean autoLogin = stClient.isAutoLogin();
        if (autoLogin) {
            try {
                if (stServer.isAuthenticated()) {
                    String status = stClient.getLoginStatus();
                    if (StringUtil.isEmpty(status)) {
                        status = "I'm available";
                    }
                    StringBuilder b = new StringBuilder(256);
                    b.append("function loggedIn(person) {\n");
                    b.append("console.debug(person.id + ' logged in successfully');\n");
                    b.append("}\n");
                    b.append("function errorHandler(reason, error) {\n");
                    b.append("console.debug('Error [' + error + ']: ' + reason);\n");
                    b.append("}\n");
                    b.append("stproxy.addOnLoad(function(){\n");
                    b.append("if(stproxy){stproxy.login.loginByToken(null");
                    b.append(",stproxy.status.AVAILABLE,'");
                    JavaScriptUtil.appendJavaScriptString(b, status);
                    b.append("',loggedIn, errorHandler)}\n");
                    b.append("});\n");
                    // b.append("dojo.addOnUnload(function(){if(stproxy){stproxy.login.logout(stproxy.session.USERID)}});\n");

                    rootEx.addScriptOnLoad(b.toString());
                }
            } catch (ClientServicesException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }

   protected JsonObject createProxyConfig(FacesContext context, UISametimeClient stClient, Endpoint stServer, String linkurl) throws IOException {
        // Get the proxy object in memory
        JsonObject proxyConfig = new JsonJavaObject();
        proxyConfig.putJsonProperty("server", stServer.getUrl());
        boolean autoTunnel = stClient.isAutoTunnelURI();
        if(autoTunnel) {
            //http://xxxx/xsp/.ibmxspres/.extlib/sbt/sametime/tunnel.html
            // Note that the URL must be absolute
            String htmlResource = FacesContext.getCurrentInstance().getExternalContext().encodeResourceURL(SBTResources.SAMETIME_TUNNEL_HTML);
            String tunnelURI = FacesUtil.makeUrlAbsolute(FacesContext.getCurrentInstance(), htmlResource);
            proxyConfig.putJsonProperty("tunnelURI", tunnelURI);
        }

        boolean connectClient = stClient.isConnectClient();
        if(connectClient) {
            proxyConfig.putJsonProperty("isConnectClient", connectClient);
        }

    if (stServer instanceof SSOEndpoint) 
        proxyConfig.putJsonProperty("tokenlogin", true);

        return proxyConfig;
    }

At this time, we are not adding this endpoint. I suggest you extend the SSOEndpoint class in a downstream project

ok. So, you do not have plans to support SSO in SametimeClientRenderer in this SDK in the future?

No plan to implement