public void doSecured ( StaplerRequest req , StaplerResponse rsp ) throws IOException , ServletException { // TODO fire something in SecurityListener? (seems to be used only for REST calls when LegacySecurityRealm is active) if ( req . getUserPrincipal ( ) == null ) { // authentication must have failed rsp . setStatus ( HttpServletResponse . SC_UNAUTHORIZED ) ; return ; } // the user is now authenticated, so send him back to the target String path = req . getContextPath ( ) + req . getOriginalRestOfPath ( ) ; String q = req . getQueryString ( ) ; if ( q != null ) path += ' ' + q ; rsp . sendRedirect2 ( path ) ; }
Checks if the user was successfully authenticated .