Klasse JSONSecureScreen

Alle implementierten Schnittstellen:
Assembler, Screen

public abstract class JSONSecureScreen extends JSONScreen
An extension to JSONScreen that performs a Security Check before invoking doBuildTemplate(). You should extend this class and add the specific security check needed. If you have a number of screens that need to perform the same check, you could make a base screen by extending this class and implementing the isAuthorized(). Then each screen that needs to perform the same check could extend your base screen.

Typically you would extend this class and override the doOutput() method to use TurbineJsonRpc to register the POJOs that will provide the functions you are making available via JSON-RPC. Use JSONScreen if you do not need the user to be logged in prior to executing the functions you provide.

Here is an example from a superclass: public void doOutput(PipelineData data) throws Exception { User user = data.getUser(); MySecureJsonFunctions myFunctions = new MySecureJsonFunctions(user.getName()); // Session specific TurbineJsonRpc.registerObject(data.getSession(), "myFunctions", myFunctions); // Global //TurbineJsonRpc.registerObjectGlobal("testGlobal", testObject); super.doOutput(data); }

The class MyFunctions would be something like: public class MySecureJsonFunctions { private final String name; public MySecureJsonFunctions(String name) { this.name = name; } private String getName(String clientParameter) { return "Client " + clientParameter + " says Hello World to " + name; } }

Version:
$Id$
Autor:
Scott Eade
  • Konstruktordetails

  • Methodendetails

    • doOutput

      protected void doOutput(PipelineData pipelineData) throws Exception
      This method overrides the method in JSONScreen to perform a security check prior to producing the output.
      Setzt außer Kraft:
      doOutput in Klasse JSONScreen
      Parameter:
      pipelineData - Turbine information.
      Löst aus:
      Exception - a generic exception.
    • isAuthorized

      protected abstract boolean isAuthorized(PipelineData pipelineData) throws Exception
      Override this method to perform the necessary security checks.
      Parameter:
      pipelineData - Turbine information.
      Gibt zurück:
      true if the user is authorized to access the screen.
      Löst aus:
      Exception - A generic exception.