本文整理了Java中org.apache.catalina.connector.Request.doGetUserPrincipal
方法的一些代码示例,展示了Request.doGetUserPrincipal
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.doGetUserPrincipal
方法的具体详情如下:
包路径:org.apache.catalina.connector.Request
类名称:Request
方法名:doGetUserPrincipal
[英]Return the principal that has been authenticated for this Request.
[中]返回已为此请求进行身份验证的主体。
代码示例来源:origin: jboss.web/jbossweb
/**
* Return the principal that has been authenticated for this Request.
*/
public Principal getUserPrincipal() {
Principal principal = doGetUserPrincipal();
if (principal instanceof GenericPrincipal) {
return ((GenericPrincipal) principal).getUserPrincipal();
} else {
return (principal);
}
}
代码示例来源:origin: org.jboss.web/jbossweb
/**
* Return the principal that has been authenticated for this Request.
*/
public Principal getUserPrincipal() {
Principal principal = doGetUserPrincipal();
if (principal instanceof GenericPrincipal) {
return ((GenericPrincipal) principal).getUserPrincipal();
} else {
return (principal);
}
}
代码示例来源:origin: org.jboss.web/jbossweb
/**
* Return the name of the remote user that has been authenticated
* for this Request.
*/
public String getRemoteUser() {
Principal principal = doGetUserPrincipal();
if (principal instanceof GenericPrincipal) {
return ((GenericPrincipal) principal).getUserPrincipal().getName();
} else if (principal != null) {
return (principal.getName());
} else {
return (null);
}
}
代码示例来源:origin: org.jboss.web/jbossweb
/**
* Return <code>true</code> if the authenticated user principal
* possesses the specified role name.
*
* @param role Role name to be validated
*/
public boolean isUserInRole(String role) {
// Have we got an authenticated principal at all?
Principal principal = doGetUserPrincipal();
if (principal == null)
return (false);
// Identify the Realm we will use for checking role assignmenets
if (context == null)
return (false);
Realm realm = context.getRealm();
if (realm == null)
return (false);
// Check for a role alias defined in a <security-role-ref> element
if (wrapper != null) {
String realRole = wrapper.findSecurityReference(role);
if ((realRole != null) &&
realm.hasRole(principal, realRole))
return (true);
}
// Check for a role defined directly as a <security-role>
return (realm.hasRole(principal, role));
}
代码示例来源:origin: jboss.web/jbossweb
/**
* Return <code>true</code> if the authenticated user principal
* possesses the specified role name.
*
* @param role Role name to be validated
*/
public boolean isUserInRole(String role) {
// Have we got an authenticated principal at all?
Principal principal = doGetUserPrincipal();
if (principal == null)
return (false);
// Identify the Realm we will use for checking role assignmenets
if (context == null)
return (false);
Realm realm = context.getRealm();
if (realm == null)
return (false);
// Check for a role alias defined in a <security-role-ref> element
if (wrapper != null) {
String realRole = wrapper.findSecurityReference(role);
if ((realRole != null) &&
realm.hasRole(principal, realRole))
return (true);
}
// Check for a role defined directly as a <security-role>
return (realm.hasRole(principal, role));
}
内容来源于网络,如有侵权,请联系作者删除!