All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.auth0.Auth0RequestWrapper Maven / Gradle / Ivy

There is a newer version: 3.4.0
Show newest version
package com.auth0;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.security.Principal;

public class Auth0RequestWrapper extends HttpServletRequestWrapper {
    String idToken;
    HttpServletRequest realRequest;

    public Auth0RequestWrapper(Tokens tokens, HttpServletRequest request) {
        super(request);

        this.idToken = tokens.getIdToken();
        this.realRequest = request;
    }

    @Override
    public Principal getUserPrincipal() {
        if (this.idToken == null) {
            return realRequest.getUserPrincipal();
        }

        return new Auth0Principal(this.idToken);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy