.. java:import:: java.io IOException .. java:import:: java.nio.charset StandardCharsets .. java:import:: java.security SecureRandom .. java:import:: java.util HashMap .. java:import:: java.util Map .. java:import:: org.json JSONException .. java:import:: org.json JSONObject SCSSSession =========== .. java:package:: com.idopte.scmapi :noindex: .. java:type:: public class SCSSSession extends Token Represents a server-side session, can be used as a \ :java:ref:`Token`\ object. Allows access to a smart card on a remote client, accessible through a network. For each created \ :java:ref:`SCSSSession`\ object, a process representing a Server Side SmartCard MiddleWare is launched. The \ :java:ref:`SCSSSession.init()`\ method has to be explicitly called before calling any method of the \ :java:ref:`Token`\ class. To release server session, call \ :java:ref:`SCSSSession.close()`\ method. To take care of the APDU command redirection, an additional HTTP entry point has to be set up on the application server, which will simply delegate the request handling to the \ :java:ref:`SCSSSession.process()`\ method. The URL of this entry point needs to be provided on the client-side when calling :js:func:`Token.processServerSession`. Note that a smart card transaction is maintained during the whole server session, and no other application can communicate with the remote smart card. Constructors ------------ SCSSSession ^^^^^^^^^^^ .. java:constructor:: public SCSSSession() throws IOException, SCMException :outertype: SCSSSession Creates a new \ :java:ref:`SCSSSession`\ object and launches a corresponding Server Side SmartCard MiddleWare. Communication with Server Side SmartCard is ensured via a specific \ :java:ref:`SCSSSession.port`\ number on localhost address. Methods ------- close ^^^^^ .. java:method:: public void close() throws SCMException, IOException :outertype: SCSSSession Closes connection with Sever Side SmartCard MiddleWare and releases corresponding session. Terminates Server Side SmartCard MiddleWare process. After this method call, SmartCard transaction on remote SmartCard will be released. getHandle ^^^^^^^^^ .. java:method:: public String getHandle() :outertype: SCSSSession Gets session ``handle``, an unique handle for each \ :java:ref:`SCSSSession`\ object. :return: the handle getSession ^^^^^^^^^^ .. java:method:: public static SCSSSession getSession(String handle) :outertype: SCSSSession Gets \ :java:ref:`SCSSSesion`\ object from a handle. :param handle: the handle of the session. :return: the \ :java:ref:`SCSSSesion`\ object init ^^^^ .. java:method:: public void init() throws SCMException, IOException :outertype: SCSSSession Connects and initialises information data from \ :java:ref:`Token`\ object. This method has to be called before using any inherited method from the \ :java:ref:`Token`\ class. process ^^^^^^^ .. java:method:: public static String process(String handle, String body) throws SCMException, IOException :outertype: SCSSSession Helper method that calls the \ :java:ref:`SCSSSession.process`\ method for the \ :java:ref:`SCSSSession`\ instance with the given ``handle``. :param handle: the handle of the \ :java:ref:`SCSSSession`\ object :param body: the body of the web request this method is called from. :return: the returned value of \ :java:ref:`SCSSSession.process`\ method. process ^^^^^^^ .. java:method:: public String process(String body) throws JSONException, SCMException, IOException :outertype: SCSSSession Manages the APDU command relaying mechanism between the server-side and the client-side middlewares. This must be called by a specific REST entry point in the application, which must be made available from the client-side application running in the browser. The URL of this entry point can be freely chosen, and must be provided as a parameter to the client-side call to :js:func:`Token.processServerSession`. :param body: the body of the web request this method is called from. :return: the result of web request this method is called from. setExecutablePath ^^^^^^^^^^^^^^^^^ .. java:method:: public static void setExecutablePath(String path) :outertype: SCSSSession Sets executable path to specify which process will be launched for Server Side SmartCard MiddleWare. If this method is never called, the default path is "bin/ssmw.exe" from the spring framework resources directory. :param path: the path for the Server Side SmartCard MiddleWare process.