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

クラス

class  OAuthHttpServletRequestWrapper
 

公開メンバ関数

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

限定公開メンバ関数

SimplePrincipal retrievePrincipalFromSessionOrRequest (final ServletRequest servletRequest)
 
final String getPropertyFromInitParams (final FilterConfig filterConfig, final String propertyName, final String defaultValue)
 

限定公開変数類

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

詳解

Implementation of a filter that wraps the normal HttpServletRequest with a wrapper that overrides the following methods to provide data from the OAuth data:

This filter needs to be configured in the chain so that it executes after both the authentication and the validation filters.

著者
Yuriy Movchan
バージョン
0.1, 03/20/2013

関数詳解

◆ destroy()

void org.gluu.oxauth.client.util.HttpServletRequestWrapperFilter.destroy ( )
inline
46  {
47  }

◆ doFilter()

void org.gluu.oxauth.client.util.HttpServletRequestWrapperFilter.doFilter ( final ServletRequest  servletRequest,
final ServletResponse  servletResponse,
final FilterChain  filterChain 
) throws IOException, ServletException
inline

Wraps the HttpServletRequest in a wrapper class that delegates request.getRemoteUser to the underlying OAuthData object stored in the user session.

55  {
56  final SimplePrincipal principal = retrievePrincipalFromSessionOrRequest(servletRequest);
57 
58  if (principal == null) {
59  log.trace("There is no principal");
60  filterChain.doFilter(servletRequest, servletResponse);
61  } else {
62  filterChain.doFilter(new OAuthHttpServletRequestWrapper((HttpServletRequest) servletRequest, principal), servletResponse);
63  }
64  }
final Log log
Definition: AbstractConfigurationFilter.java:24
SimplePrincipal retrievePrincipalFromSessionOrRequest(final ServletRequest servletRequest)
Definition: HttpServletRequestWrapperFilter.java:66

◆ 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.util.HttpServletRequestWrapperFilter.init ( final FilterConfig  filterConfig) throws ServletException
inline
42  {
43  }

◆ retrievePrincipalFromSessionOrRequest()

SimplePrincipal org.gluu.oxauth.client.util.HttpServletRequestWrapperFilter.retrievePrincipalFromSessionOrRequest ( final ServletRequest  servletRequest)
inlineprotected
66  {
67  final HttpServletRequest request = (HttpServletRequest) servletRequest;
68  final HttpSession session = request.getSession(false);
69  final OAuthData oAuthData = (OAuthData) (session == null ? request.getAttribute(Configuration.SESSION_OAUTH_DATA) : session.getAttribute(Configuration.SESSION_OAUTH_DATA));
70 
71  if (oAuthData == null) {
72  log.trace("There is no OAuthData in session");
73  return null;
74  }
75 
76  SimplePrincipal principanl = new SimplePrincipal(oAuthData.getUserUid());
77 
78  return principanl;
79  }
final Log log
Definition: AbstractConfigurationFilter.java:24

メンバ詳解

◆ log

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

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