use of org.apache.thrift.protocol.TProtocol in project jena by apache.
the class TRDF method protocol.
/**
* Decode the contents of the input stream and send to the {@link StreamRDF}.
* @param filename
*/
public static TProtocol protocol(String filename) {
InputStream in = IO.openFile(filename);
TProtocol protocol = protocol(in);
return protocol;
}
use of org.apache.thrift.protocol.TProtocol in project simba-os by cegeka.
the class SimbaFilter method doFilter.
private void doFilter(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) throws ServletException, IOException {
if (isUrlExcluded(request)) {
chain.doFilter(request, response);
return;
}
RequestData requestData = RequestUtil.createRequestData(request, simbaWebURL, simbeEidSuccessUrl);
FilterActionFactory actionFactory = new FilterActionFactory(request, response, chain);
THttpClient tHttpClient = null;
try {
tHttpClient = new THttpClient(SimbaConfiguration.getSimbaAuthenticationURL());
TProtocol tProtocol = new TJSONProtocol(tHttpClient);
AuthenticationFilterService.Client authenticationClient = new AuthenticationFilterService.Client(tProtocol);
ActionDescriptor actionDescriptor = authenticationClient.processRequest(requestData, authenticationChainName);
actionFactory.execute(actionDescriptor);
} catch (Exception e) {
throw new ServletException(e);
} finally {
if (tHttpClient != null) {
tHttpClient.close();
}
}
}
use of org.apache.thrift.protocol.TProtocol in project simba-os by cegeka.
the class SimbaJAXWSHandler method handleMessage.
@Override
public boolean handleMessage(final SOAPMessageContext context) {
if (isInboundMessage(context)) {
try {
final SOAPHeader header = context.getMessage().getSOAPHeader();
final HttpServletRequest httpServletRequest = (HttpServletRequest) context.get(MessageContext.SERVLET_REQUEST);
final ServletContext servletContext = (ServletContext) context.get(MessageContext.SERVLET_CONTEXT);
final RequestData requestData = RequestUtil.createWSSERequestData(httpServletRequest, header, getSimbaWebURL(servletContext));
THttpClient tHttpClient = null;
try {
tHttpClient = new THttpClient(getSimbaURL(servletContext));
TProtocol tProtocol = new TJSONProtocol(tHttpClient);
AuthenticationFilterService.Client authenticationClient = new AuthenticationFilterService.Client(tProtocol);
ActionDescriptor actionDescriptor = authenticationClient.processRequest(requestData, "wsLoginChain");
if (!actionDescriptor.getActionTypes().contains(ActionType.DO_FILTER_AND_SET_PRINCIPAL)) {
throw new SimbaWSAuthenticationException("Authentication Failed");
}
String username = actionDescriptor.getPrincipal();
Principal principal = null;
if (username != null) {
principal = new UserPrincipal(username);
}
if (principal != null) {
context.put(SimbaPrincipal.SIMBA_USER_CTX_KEY, principal);
context.setScope(SimbaPrincipal.SIMBA_USER_CTX_KEY, MessageContext.Scope.APPLICATION);
}
} finally {
if (tHttpClient != null) {
tHttpClient.close();
}
}
} catch (Exception e) {
throw new SimbaWSAuthenticationException("Authentication Failed", e);
}
}
return true;
}
use of org.apache.thrift.protocol.TProtocol in project simba-os by cegeka.
the class BaseRESTService method cl.
T cl() throws TException {
THttpClient tHttpClient = new THttpClient(serviceURL);
TProtocol tProtocol = new TJSONProtocol(tHttpClient);
return clientFactory.getClient(tProtocol);
}
use of org.apache.thrift.protocol.TProtocol in project simba-os by cegeka.
the class ManagerSecurityInterceptor method authenticationService.
private AuthenticationFilterService.Iface authenticationService() throws TTransportException {
THttpClient tHttpClient = new THttpClient(SystemConfiguration.getSimbaServiceURL());
TProtocol tProtocol = new TJSONProtocol(tHttpClient);
return new AuthenticationFilterService.Client(tProtocol);
}
Aggregations