com.auth0.web.Auth0RequestWrapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of auth0-spring-mvc Show documentation
Show all versions of auth0-spring-mvc Show documentation
Permits easy integration between Auth0 and a Spring app
package com.auth0.web;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.security.Principal;
/**
* Permits easy access to the Auth0User object for authenticated requests
*/
public class Auth0RequestWrapper extends HttpServletRequestWrapper {
private final HttpServletRequest realRequest;
private final Auth0User auth0User;
public Auth0RequestWrapper(final HttpServletRequest request, final Auth0User auth0User) {
super(request);
this.realRequest = request;
this.auth0User = auth0User;
}
@Override
public Principal getUserPrincipal() {
if (this.auth0User == null) {
return realRequest.getUserPrincipal();
}
return auth0User;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy