Expose Principal as attribute/property in request types
@@ -36,6 +36,7 @@ public abstract class DiscFilterRequest {
protected static final String HTTPS_PREFIX = "https";
protected static final int DEFAULT_HTTP_PORT = 80;
protected static final int DEFAULT_HTTPS_PORT = 443;
+ private static final String JDISC_REQUEST_PRINCIPAL = "jdisc.request.principal";
private final ServletOrJdiscHttpRequest parent;
protected final InetSocketAddress localAddress;
@@ -330,7 +331,7 @@ public abstract class DiscFilterRequest {
}
public Principal getUserPrincipal() {
- return userPrincipal;
+ return (Principal) getAttribute(JDISC_REQUEST_PRINCIPAL);
}
public boolean isSecure() {
@@ -375,7 +376,7 @@ public abstract class DiscFilterRequest {
}
public void setUserPrincipal(Principal principal) {
- this.userPrincipal = principal;
+ setAttribute(JDISC_REQUEST_PRINCIPAL, principal);
}
public void setUserRoles(String[] roles) {
