001
014
015 package com.liferay.portal.kernel.security.auth.tunnel;
016
017 import com.liferay.portal.security.auth.AuthException;
018 import com.liferay.registry.Registry;
019 import com.liferay.registry.RegistryUtil;
020 import com.liferay.registry.ServiceTracker;
021
022 import java.net.HttpURLConnection;
023
024 import javax.servlet.http.HttpServletRequest;
025
026
029 public class TunnelAuthenticationManagerUtil {
030
031 public static long getUserId(HttpServletRequest httpServletRequest)
032 throws AuthException {
033
034 return getTunnelManagerUtil().getUserId(httpServletRequest);
035 }
036
037 public static void setCredentials(
038 String login, HttpURLConnection httpURLConnection)
039 throws Exception {
040
041 getTunnelManagerUtil().setCredentials(login, httpURLConnection);
042 }
043
044 private static TunnelAuthenticationManager getTunnelManagerUtil() {
045 return _instance._serviceTracker.getService();
046 }
047
048 private TunnelAuthenticationManagerUtil() {
049 Registry registry = RegistryUtil.getRegistry();
050
051 _serviceTracker = registry.trackServices(
052 TunnelAuthenticationManager.class);
053
054 _serviceTracker.open();
055 }
056
057 private static final TunnelAuthenticationManagerUtil _instance =
058 new TunnelAuthenticationManagerUtil();
059
060 private final ServiceTracker<?, TunnelAuthenticationManager>
061 _serviceTracker;
062
063 }