Skip to content

vlex/remote_auth

Repository files navigation

Single sign-on to vLex.com with remote authentication

Grants single sign-on access to users with a corporate account.

To use this function, the company needs a unique account_id and token which can be obtained from vLex web page, as explained in the related support topic

The main entry point is the remote_auth function.

This collects the parameters (either provided by the same user with a web form or included by the company with hidden fields) and returns the URL where the user should be redirected to enter vLex without explicitly signing in.

PHP version

Download the remote_auth.php file to your local server, then call the remote authentication function passing the appropriate parameters, for instance:

$my_data = array("account_id" => "1234", "name" => "tester", "token" => "TOKEN", "email" => "test@vlex.com");
remote_auth($my_data);

Ruby version

Download the remote_auth.rb file to your local server, then call the remote authentication function passing the appropriate parameters, for instance:

data = {:account_id => "1234", :name => "tester", :token => "TOKEN", :email => "test@vlex.com"}
Vlex::RemoteAuth::remote_auth data

ASP Classic version

Download the remote_auth.asp file to your local server, then call the remote authentication function passing the appropriate parameters, for instance:


  redirect_to_remote_auth(name, email, account_id, token)

ColdFusion version

Download the sso-vlex.cfm file to your local server, then call the remote authentication function passing the appropriate parameters, for instance:



 <cfset account_id = "1234">
 <cfset token = "TOKEN">
 <cfset name = "NAME">
 <cfset email = "EMAIL">

 <cfset startTime = "{ts '1970-01-01 00:00:00'}">
 <cfset nowTime = now()>
 <cfset seconds = dateDiff('s',startTime,nowTime)>
 <cfset seconds = seconds + 10800>


 <cfset tmp= name & email & account_id & token & seconds>
 <cfset hash = LCase(Hash(tmp, "MD5"))>

 <cfset link = "http://vlex.com/session/remote_auth?name=" & name & "&email=" & email & "&account_id=" & account_id & "&timestamp=" & seconds & "&hash=" & hash> 


Example coldfusion

JSP version

Download the RemoteAuth.java file to your local server, then call the remote authentication function passing the appropriate parameters, for instance:


<%@page import="java.util.HashMap,vlex.RemoteAuth"%>
<%
        HashMap<String,String >hash = new HashMap<String,String>(5);
        hash.put("name",request.getParameter("name")); 
        hash.put("email",request.getParameter("email"));
        hash.put("account_id","[ID CUENTA]");
        hash.put("token","[TOKEN]");
        Number current = System.currentTimeMillis()/1000;
        hash.put("timestamp",current.toString());        
        String link = RemoteAuth.remote_auth(hash);
        response.sendRedirect(link);
%>


Example jsp

Python

Download the RemoteAuth.py file to your local server, then call the remote authentication function passing the appropriate parameters, for instance:


        token = [token]
        account_id = [ACCOUNT ID]
        name = [USUARIO]
        email = [E-MAIL]        


Example Python

C#

Download the RemoteAuth.cs file to your local server, then call the remote authentication function passing the appropriate parameters, for instance:


        // Define a hash with the necessary parameters
        Hashtable hash = new Hashtable();
        string tmp = "test@vlex.test";
        hash.Add("name",tmp); 
        hash.Add("email",tmp);
        hash.Add("account_id",[ACCOUNT_ID]); # Valor entero.
        hash.Add("token",[TOKEN]); # String

        // Get the parameters for the request (name,email,account_id,hash,sha256,timestamp)  
        Hashtable postdata = RemoteAuth.remote_auth(hash);
        
        // Make the request to https://vlex.com/session/remote_auth with the parameters obtained previously (by GET or POST)


About

Utility functions to grant single sign-on access to vLex.com via remote authentication

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published