Code example for Principal

Methods: getName

0
    @Override 
    protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException,
            IOException { 
        final Principal googleUser = request.getUserPrincipal();
        if (googleUser != null) {
            final UserAccount userFromProvider = ProviderAuth.GOOGLE.get(null, googleUser.getName());
            ServletHelper.setUserInDBAndSession(userFromProvider, request);
        } 
        response.sendRedirect(ServletHelper.getApplicationURL(request));
 
    } 
 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE