All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.antelopeframework.remoting.server.HessianServiceExporter Maven / Gradle / Ivy

There is a newer version: 1.1.5
Show newest version
package com.github.antelopeframework.remoting.server;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.github.antelopeframework.remoting.server.auth.RemoteCallAuthenticate;

import lombok.Setter;

@Setter
public class HessianServiceExporter extends org.springframework.remoting.caucho.HessianServiceExporter {
	public final static String HTTPINVOKER_PARAM_APP = "_httpinvoker_app";
	public final static String HTTPINVOKER_PARAM_USER = "_httpinvoker_user";
	public final static String HTTPINVOKER_PARAM_PASSWORD = "_httpinvoker_password";
	public final static String HTTPINVOKER_PARAM_TIMESTAMP = "_httpinvoker_timestamp";
	
	private RemoteCallAuthenticate remoteCallAuthenticate;
	
	@Override
	public void handleRequest(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		String app = request.getHeader(HTTPINVOKER_PARAM_APP); 
		String username = request.getHeader(HTTPINVOKER_PARAM_USER);  
        String password = request.getHeader(HTTPINVOKER_PARAM_PASSWORD); 
        
        if (remoteCallAuthenticate != null && !remoteCallAuthenticate.auth(app, username, password)) {
        	throw new ServletException("Authorization failed.");  
        }
        
		super.handleRequest(request, response);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy