jet.server.api.http
Interface HttpExternalAuthorized

All Superinterfaces:
ExternalAuthorized

public interface HttpExternalAuthorized
extends ExternalAuthorized

Via this interface, the report server gets the user ID of the user that was authorized by an external authenticator. To implement this interface, you can design a mechanism to transfer the authorized user information by HTTP requests. Users can specify their own implementations of this interface by the system property "jrs.httpExternalAuthorized" in the command line.

 For example: 
 Suppose the implementation of this interface is com.mycorp.HttpExternalAuthorizedImpl.class.
 Then use the command line to start the JReport Server (JRServer.bat/sh) or the application server that JReport is published into:
 java -Djrs.httpExternalAuthorized=com.mycorp.HttpExternalAuthorizedImpl ...
 

See Also:
ExternalAuthorized

Field Summary
static java.lang.String propertyName
          The system property name for the implementation of this interface.
 
Method Summary
 java.lang.String getExternalAuthorizedUser(java.lang.String activeRealm, javax.servlet.http.HttpServletRequest req)
          Gets the external authorized user ID.
 boolean handleUnAuthenticatedRequest(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, java.lang.String authScheme, java.lang.String realm)
          Handles unauthenticated requests.
 
Methods inherited from interface jet.server.api.ExternalAuthorized
askInvalidate, getExternalAuthorizedUser, notifyLogout
 

Field Detail

propertyName

static final java.lang.String propertyName
The system property name for the implementation of this interface. Users can specify the implementation of this interface by this system property "jrs.httpExternalAuthorized" in the command line.
 For example: 
 Suppose the implementation of this interface is com.mycorp.HttpExternalAuthorizedImpl.class.
 Then use the command line to start the report server:
 java -Djrs.httpExternalAuthorized=com.mycorp.HttpExternalAuthorizedImpl ...
 

See Also:
Constant Field Values
Method Detail

getExternalAuthorizedUser

java.lang.String getExternalAuthorizedUser(java.lang.String activeRealm,
                                           javax.servlet.http.HttpServletRequest req)
Gets the external authorized user ID. To implement this interface, design a mechanism to transfer the authorized user information by HTTP requests.

Parameters:
activeRealm - the active realm.
req - the HttpServletRequest object.
Returns:
the external authorized user ID. Returns null if it cannot get the authorized user information from the HttpServletRequest object. The user ID should be a valid user ID of the report server.

handleUnAuthenticatedRequest

boolean handleUnAuthenticatedRequest(javax.servlet.http.HttpServletRequest req,
                                     javax.servlet.http.HttpServletResponse res,
                                     java.lang.String authScheme,
                                     java.lang.String realm)
                                     throws java.io.IOException
Handles unauthenticated requests. The report server calls this method before sending the HTTP unauthorized response (HTTP 401) to the client. Using this method, you can send your response to the client to handle the unauthenticated request. If this method returns true, the report server will send the HTTP unauthorized response (HTTP 401) to the client, otherwise it will not send the HTTP unauthorized response.

Parameters:
req - the HttpServletRequest.
res - the HttpServletResponse.
authScheme - the authentication scheme. The available value is "Basic" or "Digest".
realm - the realm.
Returns:
whether or not the report server should send the HTTP unauthorized response (HTTP 401) to the client. If it returns true, the report server will send the HTTP unauthorized response (HTTP 401) to the client.
Throws:
java.io.IOException - if an IOException occurs.