本文整理了Java中org.apache.catalina.connector.Request.getUserPrincipal
方法的一些代码示例,展示了Request.getUserPrincipal
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getUserPrincipal
方法的具体详情如下:
包路径:org.apache.catalina.connector.Request
类名称:Request
方法名:getUserPrincipal
[英]Return the principal that has been authenticated for this Request.
[中]返回已为此请求进行身份验证的主体。
代码示例来源:origin: org.glassfish.main.web/web-core
@Override
public java.security.Principal getUserPrincipal() {
if (request == null) {
throw new IllegalStateException(rb.getString(LogFacade.CANNOT_USE_REQUEST_OBJECT_OUTSIDE_SCOPE_EXCEPTION));
}
return request.getUserPrincipal();
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
@Override
public java.security.Principal getUserPrincipal() {
if (request == null) {
throw new IllegalStateException(
sm.getString("requestFacade.nullRequest"));
}
return request.getUserPrincipal();
}
代码示例来源:origin: codefollower/Tomcat-Research
@Override
public java.security.Principal getUserPrincipal() {
if (request == null) {
throw new IllegalStateException(
sm.getString("requestFacade.nullRequest"));
}
return request.getUserPrincipal();
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-tomcat
public void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthException
{
Request request = (Request) messageInfo.getRequestMessage();
Principal principal = request.getUserPrincipal();
if(subject != null)
subject.getPrincipals().remove(principal);
}
代码示例来源:origin: tomcat/catalina
public java.security.Principal getUserPrincipal() {
if (request == null) {
throw new IllegalStateException(
sm.getString("requestFacade.nullRequest"));
}
return request.getUserPrincipal();
}
代码示例来源:origin: org.jboss.web/jbossweb
public java.security.Principal getUserPrincipal() {
if (request == null) {
throw MESSAGES.nullRequestFacade();
}
return request.getUserPrincipal();
}
代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina
@Override
public java.security.Principal getUserPrincipal() {
if (request == null) {
throw new IllegalStateException(
sm.getString("requestFacade.nullRequest"));
}
return request.getUserPrincipal();
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
@Override
public java.security.Principal getUserPrincipal() {
if (request == null) {
throw new IllegalStateException(
sm.getString("requestFacade.nullRequest"));
}
return request.getUserPrincipal();
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
@Override
public java.security.Principal getUserPrincipal() {
if (request == null) {
throw new IllegalStateException(
sm.getString("requestFacade.nullRequest"));
}
return request.getUserPrincipal();
}
代码示例来源:origin: jboss.web/jbossweb
public java.security.Principal getUserPrincipal() {
if (request == null) {
throw new IllegalStateException(
sm.getString("requestFacade.nullRequest"));
}
return request.getUserPrincipal();
}
代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina
@Override
public java.security.Principal getUserPrincipal() {
if (request == null) {
throw new IllegalStateException(
sm.getString("requestFacade.nullRequest"));
}
return request.getUserPrincipal();
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
@Override
public java.security.Principal getUserPrincipal() {
if (request == null) {
throw new IllegalStateException(
sm.getString("requestFacade.nullRequest"));
}
return request.getUserPrincipal();
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7
@Override
public java.security.Principal getUserPrincipal() {
if (request == null) {
throw new IllegalStateException(
sm.getString("requestFacade.nullRequest"));
}
return request.getUserPrincipal();
}
代码示例来源:origin: org.glassfish.main.web/web-core
@Override
public void logout() throws ServletException {
Realm realm = (context == null ? null : context.getRealm());
if (realm == null) {
if (getUserPrincipal() != null || getAuthType() != null) {
throw new ServletException(
rb.getString(LogFacade.INTERNAL_LOGOUT_ERROR));
}
return;
}
/*
* Pass the request (this).
*/
realm.logout(this);
}
代码示例来源:origin: com.tomitribe.tribestream/tribestream-container
private boolean validateRole(final String roleName, final RequestContext requestContext) {
final long start = System.nanoTime();
final boolean userInRole = requestContext.getRequest().isUserInRole(roleName);
RouteEventsLogger.evaluateRole(roleName, userInRole, start);
String logMessage = null;
if(userInRole){
logMessage = requestContext.getRequest().getUserPrincipal().getName() + " has the role '" + roleName + "'";
}else{
logMessage = requestContext.getRequest().getUserPrincipal().getName() + " doesn't have the role '" + roleName + "'";
}
requestContext.getEventHandler().info("roles", logMessage);
return userInRole;
}
代码示例来源:origin: com.tomitribe.tribestream/tribestream-container
private boolean validateRoles(final RouteMetaData route, final RequestContext requestContext) {
if (route.getRoles() == null || route.getRoles().isEmpty()) {
return true;
}
if (requestContext.getRequest().getUserPrincipal() == null) {
return false;
}
if (route.getRolesRequired().contains(RouteMetaData.Require.ANY)) {
return route.getRoles().stream().anyMatch(role -> validateRole(role.getName(), requestContext));
} else {
return route.getRoles().stream().allMatch(role -> validateRole(role.getName(), requestContext));
}
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* {@inheritDoc}
*/
@Override
public void login(String username, String password)
throws ServletException {
if (getAuthType() != null || getRemoteUser() != null ||
getUserPrincipal() != null) {
throw new ServletException(
sm.getString("coyoteRequest.alreadyAuthenticated"));
}
getContext().getAuthenticator().login(username, password, this);
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-tomcat
public void invoke(Request request, Response response)
throws IOException, ServletException
{
Principal user = request.getUserPrincipal();
if( user instanceof JBossGenericPrincipal )
{
// Restore the actual principal to the request
JBossGenericPrincipal guser = (JBossGenericPrincipal) user;
Principal realUser = guser.getCallerPrincipal();
request.setUserPrincipal(realUser);
}
getNext().invoke(request, response);
}
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
/**
* {@inheritDoc}
*/
@Override
public void login(String username, String password)
throws ServletException {
if (getAuthType() != null || getRemoteUser() != null ||
getUserPrincipal() != null) {
throw new ServletException(
sm.getString("coyoteRequest.alreadyAuthenticated"));
}
getContext().getAuthenticator().login(username, password, this);
}
代码示例来源:origin: apereo/java-cas-client
/** {@inheritDoc} */
public final boolean authenticate(final Request request, final HttpServletResponse response,
final LoginConfig loginConfig) throws IOException {
Principal principal = request.getUserPrincipal();
boolean result = false;
if (principal == null) {
// Authentication sets the response headers for status and redirect if needed
principal = this.delegate.authenticate(request.getRequest(), response);
if (principal != null) {
register(request, response, principal, getAuthenticationMethod(), null, null);
result = true;
}
} else {
result = true;
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!