本文整理了Java中javax.servlet.http.HttpServletRequestWrapper.getUserPrincipal()
方法的一些代码示例,展示了HttpServletRequestWrapper.getUserPrincipal()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpServletRequestWrapper.getUserPrincipal()
方法的具体详情如下:
包路径:javax.servlet.http.HttpServletRequestWrapper
类名称:HttpServletRequestWrapper
方法名:getUserPrincipal
[英]The default behavior of this method is to return getUserPrincipal() on the wrapped request object.
[中]此方法的默认行为是在包装的请求对象上返回getUserPrincipal()。
代码示例来源:origin: cloudfoundry/uaa
@Override
public Principal getUserPrincipal() {
return super.getUserPrincipal();
}
代码示例来源:origin: apache/geode
/**
* {@inheritDoc}
*/
@Override
public Principal getUserPrincipal() {
if (outerRequest != null) {
return outerRequest.getUserPrincipal();
} else {
return super.getUserPrincipal();
}
}
代码示例来源:origin: apache/shiro
public Principal getUserPrincipal() {
Principal userPrincipal;
Object scPrincipal = getSubjectPrincipal();
if (scPrincipal != null) {
if (scPrincipal instanceof Principal) {
userPrincipal = (Principal) scPrincipal;
} else {
userPrincipal = new ObjectPrincipal(scPrincipal);
}
} else {
userPrincipal = super.getUserPrincipal();
}
return userPrincipal;
}
代码示例来源:origin: apache/hbase
@Test
public void testFilter() throws Exception {
FilterConfig config = mockConfig("myuser");
StaticUserFilter suf = new StaticUserFilter();
suf.init(config);
ArgumentCaptor<HttpServletRequestWrapper> wrapperArg =
ArgumentCaptor.forClass(HttpServletRequestWrapper.class);
FilterChain chain = mock(FilterChain.class);
suf.doFilter(mock(HttpServletRequest.class), mock(ServletResponse.class),
chain);
Mockito.verify(chain).doFilter(wrapperArg.capture(), Mockito.<ServletResponse>anyObject());
HttpServletRequestWrapper wrapper = wrapperArg.getValue();
assertEquals("myuser", wrapper.getUserPrincipal().getName());
assertEquals("myuser", wrapper.getRemoteUser());
suf.destroy();
}
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
public Principal getUserPrincipal()
{
Principal userPrincipal = super.getUserPrincipal();
return userPrincipal;
}
代码示例来源:origin: com.liferay.portal/portal-kernel
public Principal getUserPrincipal() {
if (_userPrincipal != null) {
return _userPrincipal;
}
else {
return super.getUserPrincipal();
}
}
代码示例来源:origin: com.butor/butor-web
@Override
public Principal getUserPrincipal() {
if (principal == null) {
return super.getUserPrincipal();
}
return principal;
}
}
代码示例来源:origin: com.github.wuic/wuic-servlet
/**
* {@inheritDoc}
*/
@Override
public Principal getUserPrincipal() {
// Synchronized access
synchronized (mutex) {
return super.getUserPrincipal();
}
}
代码示例来源:origin: GluuFederation/oxTrust
@Override
public Principal getUserPrincipal() {
Principal principal = super.getUserPrincipal();
if (principal != null)
return principal;
else
return userPrincipal;
}
代码示例来源:origin: fcrepo3/fcrepo
@Override
public Principal getUserPrincipal() {
//this order reinforces that container-supplied userPrincipal should not be overridden in setUserPrincipal()
Principal userPrincipal = super.getUserPrincipal();
if (userPrincipal == null) {
userPrincipal = this.userPrincipal;
}
return userPrincipal;
}
代码示例来源:origin: org.fcrepo/fcrepo-server
@Override
public Principal getUserPrincipal() {
//this order reinforces that container-supplied userPrincipal should not be overridden in setUserPrincipal()
Principal userPrincipal = super.getUserPrincipal();
if (userPrincipal == null) {
userPrincipal = this.userPrincipal;
}
return userPrincipal;
}
代码示例来源:origin: com.force.sdk/force-oauth
@Override
public Principal getUserPrincipal() {
return userP != null ? userP : super.getUserPrincipal();
}
代码示例来源:origin: forcedotcom/java-sdk
@Override
public Principal getUserPrincipal() {
return userP != null ? userP : super.getUserPrincipal();
}
代码示例来源:origin: Jasig/uPortal
@Override
public Principal getUserPrincipal() {
this.checkState();
return super.getUserPrincipal();
}
代码示例来源:origin: org.picketlink/picketlink-federation
@Override
public Principal getUserPrincipal() {
HttpSession session = getSession(false);
if (session != null) {
return (Principal) session.getAttribute(GeneralConstants.PRINCIPAL_ID);
}
return super.getUserPrincipal();
}
};
代码示例来源:origin: org.jasig.portal/uPortal-rendering
@Override
public Principal getUserPrincipal() {
this.checkState();
return super.getUserPrincipal();
}
代码示例来源:origin: picketlink/picketlink
@Override
public Principal getUserPrincipal() {
HttpSession session = getSession(false);
if (session != null) {
return (Principal) session.getAttribute(GeneralConstants.PRINCIPAL_ID);
}
return super.getUserPrincipal();
}
};
代码示例来源:origin: org.apache.wink/wink-server
@Override
public Principal getUserPrincipal() {
return getCorrectRequest().getUserPrincipal();
}
代码示例来源:origin: org.jboss.seam/jboss-seam
@Override
public Principal getUserPrincipal()
{
return seamSecurityIsActive() ? identity.getPrincipal() : super.getUserPrincipal();
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
@Test
public void testFilter() throws Exception {
FilterConfig config = mockConfig("myuser");
StaticUserFilter suf = new StaticUserFilter();
suf.init(config);
ArgumentCaptor<HttpServletRequestWrapper> wrapperArg =
ArgumentCaptor.forClass(HttpServletRequestWrapper.class);
FilterChain chain = mock(FilterChain.class);
suf.doFilter(mock(HttpServletRequest.class), mock(ServletResponse.class),
chain);
Mockito.verify(chain).doFilter(wrapperArg.capture(), Mockito.<ServletResponse>anyObject());
HttpServletRequestWrapper wrapper = wrapperArg.getValue();
assertEquals("myuser", wrapper.getUserPrincipal().getName());
assertEquals("myuser", wrapper.getRemoteUser());
suf.destroy();
}
内容来源于网络,如有侵权,请联系作者删除!