SCSSSession

public class SCSSSession extends Token

Represents a server-side session, can be used as a Token object. Allows access to a smart card on a remote client, accessible through a network.

For each created SCSSSession object, a process representing a Server Side SmartCard MiddleWare is launched.

The SCSSSession.init() method has to be explicitly called before calling any method of the Token class. To release server session, call 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 SCSSSession.process() method. The URL of this entry point needs to be provided on the client-side when calling 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

public SCSSSession()

Creates a new SCSSSession object and launches a corresponding Server Side SmartCard MiddleWare. Communication with Server Side SmartCard is ensured via a specific SCSSSession.port number on localhost address.

Methods

close

public void close()

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

public String getHandle()

Gets session handle, an unique handle for each SCSSSession object.

Returns:

the handle

getSession

public static SCSSSession getSession(String handle)

Gets SCSSSesion object from a handle.

Parameters:
  • handle – the handle of the session.

Returns:

the SCSSSesion object

init

public void init()

Connects and initialises information data from Token object. This method has to be called before using any inherited method from the Token class.

process

public static String process(String handle, String body)

Helper method that calls the SCSSSession.process method for the SCSSSession instance with the given handle.

Parameters:
  • handle – the handle of the SCSSSession object

  • body – the body of the web request this method is called from.

Returns:

the returned value of SCSSSession.process method.

process

public String process(String body)

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 Token.processServerSession().

Parameters:
  • body – the body of the web request this method is called from.

Returns:

the result of web request this method is called from.

setExecutablePath

public static void setExecutablePath(String path)

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.

Parameters:
  • path – the path for the Server Side SmartCard MiddleWare process.