*/
public boolean checkAuthentication(Redirector redirector,
String handlerName,
String applicationName)
throws IOException, ProcessingException {
HandlerConfiguration config = this.getHandlerConfiguration( handlerName );
if ( config == null ) {
throw new ProcessingException("Unknown handler to check: " + handlerName);
}
// are we already logged in?
UserHandler handler = this.getUserHandler( handlerName );
final boolean authenticated = ( handler != null );
if ( !authenticated ) {
// create parameters
SourceParameters parameters = config.getRedirectParameters();
if (parameters == null) parameters = new SourceParameters();
final Request request = this.getRequest();
String resource = request.getRequestURI();
if (request.getQueryString() != null) {
resource += '?' + request.getQueryString();
}
parameters.setSingleParameterValue("resource", resource);
final String redirectURI = config.getRedirectURI();
redirector.globalRedirect(false, SourceUtil.appendParameters(redirectURI, parameters));
} else {
// update state
RequestState state = new RequestState( handler, applicationName, this.resolver );
RequestState.setState( state );