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));
 
    } 
 
}