Accessing a Local Instance of the Secured Engine
If a local Flux engine has been created with security enabled, you can log in to it using the flux.LocalSecurity interfance, which can be created from the flux.Factory class. You log in to the engine by calling LocalSecurity.login(), passing in the reference to the engine and either a security subject or a username/password pair.
Security is viewed on a per-thread basis. If you log in as the user "mary" in one thread, for example, you can't log in as another user "john" without first logging out user "mary".
For an example of accessing a local instance of the secured engine, refer to the /examples/end_users/Security and /examples/software_developers/security directories under the Flux installation directory.
Accessinga Secured Engine Remotely Using RMI
If you create a secured Flux engine from the command line (see the start-secure-flux-engine script in the Flux installation directory for an example), you don't need to explicitly enable remote acess. This will be performed by Flux automatically upon initialization.
If you create the secured engine using the Flux API, however, you will need to enable remote security to ensure that you can access the engine remotely. To do so, you simply create a flux.RemoteSecurity instance to interact with the engine, as in the following code:
The Factory.makeRemoteSecurity() method accepts two arguments: the Configuration object that was used to create the engine and the Engine instance that should have remote security enabled.
Once you have enabled remote security on an engine, your client code can look up the engine like so:
In this way the remote object provides an RMI frontend for the secured engine, and assurs that only authorizes users can get a reference to the engine.