Code example for Principal

Methods: getName

0
    private BusinessContext businessContext;
 
    @Override 
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        Principal principal = request.getUserPrincipal();
        logger.debug("principal: {}", principal);
        businessContext.setUsername(principal.getName());
        return true; 
    } 
}