jet.server.api.http
Interface HttpExternalAuthorized

All Superinterfaces:
ExternalAuthorized

public interface HttpExternalAuthorized
extends ExternalAuthorized

By this interface, the report server gets the user ID who was authorized by an external authenticator. To implement this interface, can design a mechanism to transfer the authorized user info by HTTP requests. Users can specify the user's implementation 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 report server:
 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, HttpServletRequest req)
          Gets the external authorized user ID.
 boolean handleUnAuthenticatedRequest(HttpServletRequest req, HttpServletResponse res, java.lang.String authScheme, java.lang.String realm)
          Handle unauthenticated requests.
 
Methods inherited from interface jet.server.api.ExternalAuthorized
askInvalidate, notifyLogout
 

Field Detail

propertyName

static final java.lang.String propertyName
The system property name for the implementation of this interface. Users can specify the user's 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,
                                           HttpServletRequest req)
Gets the external authorized user ID. To implement this interface, can design a mechanism to transfer the authorized user info by HTTP requests.

Specified by:
getExternalAuthorizedUser in interface ExternalAuthorized
Parameters:
activeRealm - the active realm.
req - the HttpServletRequest object.
Returns:
the external authorized user ID. Return null if can not get authorized user info from the HttpServletRequest object. The user ID should be a valid user ID of the report server.

handleUnAuthenticatedRequest

boolean handleUnAuthenticatedRequest(HttpServletRequest req,
                                     HttpServletResponse res,
                                     java.lang.String authScheme,
                                     java.lang.String realm)
                                     throws java.io.IOException
Handle unauthenticated requests. The report server call this method before send the HTTP unauthorized response(HTTP 401) to the client. In this method, can send your response to the client to handle the unauthenticated request. If this method return true, the report server will send the HTTP unauthorized response(HTTP 401) to the client, otherwise will not send the HTTP unauthorized response.

Parameters:
req - the HttpServletRequest.
res - the HttpServletResponse.
authScheme - the the authentication scheme. The available values are "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 return true, the report server will send the HTTP unauthorized response(HTTP 401) to the client.
Throws:
java.io.IOException - if a IOException occurs.