gluu
公開メンバ関数 | 静的公開メンバ関数 | 限定公開メンバ関数 | 限定公開変数類 | 全メンバ一覧
org.gluu.oxauth.client.logout.LogoutFilter クラス
org.gluu.oxauth.client.logout.LogoutFilter の継承関係図
Inheritance graph
org.gluu.oxauth.client.logout.LogoutFilter 連携図
Collaboration graph

公開メンバ関数

void init (FilterConfig filterConfig) throws ServletException
 
void destroy ()
 
void doFilter (ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException
 

静的公開メンバ関数

static String getParameter (final HttpServletRequest request, final String parameter)
 

限定公開メンバ関数

final String constructRedirectUrl (final HttpServletRequest request)
 
final String getPropertyFromInitParams (final FilterConfig filterConfig, final String propertyName, final String defaultValue)
 

限定公開変数類

final Log log = LogFactory.getLog(getClass())
 

詳解

Filter implementation to intercept all requests and attempt to logout the client by redirecting them to OAuth.

著者
Dmitry Ognyannikov

関数詳解

◆ constructRedirectUrl()

final String org.gluu.oxauth.client.session.AbstractOAuthFilter.constructRedirectUrl ( final HttpServletRequest  request)
inlineprotectedinherited
21  {
22  int serverPort = request.getServerPort();
23 
24  String redirectUrl;
25  if ((serverPort == 80) || (serverPort == 443)) {
26  redirectUrl = String.format("%s://%s%s%s", request.getScheme(), request.getServerName(), request.getContextPath(), "/auth-code.jsp");
27  } else {
28  redirectUrl = String.format("%s://%s:%s%s%s", request.getScheme(), request.getServerName(), request.getServerPort(), request.getContextPath(), "/auth-code.jsp");
29  }
30 
31  return redirectUrl.toLowerCase();
32  }

◆ destroy()

void org.gluu.oxauth.client.logout.LogoutFilter.destroy ( )
inline
34  {
35  }

◆ doFilter()

void org.gluu.oxauth.client.logout.LogoutFilter.doFilter ( ServletRequest  servletRequest,
ServletResponse  servletResponse,
FilterChain  chain 
) throws IOException, ServletException
inline
38  {
39  final HttpServletRequest request = (HttpServletRequest) servletRequest;
40  final HttpServletResponse response = (HttpServletResponse) servletResponse;
41 
42  HttpSession session = request.getSession(false);
43 
44  String urlToRedirectTo;
45  try {
46  SignOutHandler signOutHandler = SignOutHandler.instance();
47  urlToRedirectTo = signOutHandler.getOAuthLogoutUrl(request);
48  if (urlToRedirectTo == null) {
49  urlToRedirectTo = signOutHandler.constructRedirectUrl(request);
50  }
51  } catch (Exception ex) {
52  log.error("Failed to preapre request to OAuth server", ex);
53  if (session != null) {
54  // clear session
55  session.invalidate();
56  }
57  return;
58  }
59 
60  if (session != null) {
61  // clear session
62  session.invalidate();
63  }
64 
65  log.debug("Redirecting to \"" + urlToRedirectTo + "\"");
66  response.sendRedirect(urlToRedirectTo);
67  }
final Log log
Definition: AbstractConfigurationFilter.java:24

◆ getParameter()

static String org.gluu.oxauth.client.session.AbstractOAuthFilter.getParameter ( final HttpServletRequest  request,
final String  parameter 
)
inlinestaticinherited

Method for retrieving a parameter from the request without disrupting the reader UNLESS the parameter actually exists in the query string.

引数
requestthe request to check.
parameterthe parameter to look for.
戻り値
the value of the parameter.
42  {
43  return request.getQueryString() == null || request.getQueryString().indexOf(parameter) == -1 ? null : request.getParameter(parameter);
44  }

◆ getPropertyFromInitParams()

final String org.gluu.oxauth.client.util.AbstractConfigurationFilter.getPropertyFromInitParams ( final FilterConfig  filterConfig,
final String  propertyName,
final String  defaultValue 
)
inlineprotectedinherited

Retrieves the property from the FilterConfig. First it checks the FilterConfig's initParameters to see if it has a value. If it does, it returns that, otherwise it retrieves the ServletContext's initParameters and returns that value if any.

引数
filterConfigthe Filter Configuration.
propertyNamethe property to retrieve.
defaultValuethe default value if the property is not found.
戻り値
the property value, following the above conventions. It will always return the more specific value (i.e. filter vs. context).
35  {
36 // final String value = filterConfig.getInitParameter(propertyName);
37 //
38 // if (StringHelper.isNotEmpty(value)) {
39 // log.info("Property [" + propertyName + "] loaded from FilterConfig.getInitParameter with value [" + value + "]");
40 // return value;
41 // }
42 //
43 // final String value2 = filterConfig.getServletContext().getInitParameter(propertyName);
44 // if (StringHelper.isNotEmpty(value2)) {
45 // log.info("Property [" + propertyName + "] loaded from ServletContext.getInitParameter with value [" + value2 + "]");
46 // return value2;
47 // }
48 
49  final String value3 = Configuration.instance().getPropertyValue(propertyName);
50  if (StringHelper.isNotEmpty(value3)) {
51  log.info("Property [" + propertyName + "] loaded from oxTrust.properties");
52  return value3;
53  }
54 
55  log.info("Property [" + propertyName + "] not found. Using default value [" + defaultValue + "]");
56  return defaultValue;
57  }
final Log log
Definition: AbstractConfigurationFilter.java:24

◆ init()

void org.gluu.oxauth.client.logout.LogoutFilter.init ( FilterConfig  filterConfig) throws ServletException
inline
30  {
31  }

メンバ詳解

◆ log

final Log org.gluu.oxauth.client.util.AbstractConfigurationFilter.log = LogFactory.getLog(getClass())
protectedinherited

このクラス詳解は次のファイルから抽出されました: