code: public boolean authenticate(MobicentsSipServletRequest request, MobicentsSipServletResponse response,
              MobicentsSipLoginConfig config, String securityDomain, Deployment deployment, ServletInfo servletInfo,
              SipStack sipStack) throws IOException {
  
          principal = null;
  
          // Have we already authenticated someone?
          principal = request.getUserPrincipal();
          // String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE);
          if (principal != null) {
              if (log.isDebugEnabled())
                  log.debug("Already authenticated '" + principal.getName() + "'");
  
              return (true);
          }
  
          // Validate any credentials already included with this request
          String authorization = request.getHeader("authorization");
          if (authorization != null) {
  
              principal = findPrincipal(request, authorization, this.realmName, securityDomain, deployment, servletInfo, sipStack);
              if (principal != null &&
              // fix for http://code.google.com/p/sipservlets/issues/detail?id=88
                      principal.getPrincipal() != null) {
                  String username = parseUsername(authorization);
                  register(request, response, principal, "DIGEST",// Constants.DIGEST_METHOD,
                          username, null);
                  return (true);
              }
          }
  
          // Send an "unauthorized" response and an appropriate challenge
  
          // Next, generate a nOnce token (that is a token which is supposed
          // to be unique).
          String nOnce = generateNOnce(request);
  
          setAuthenticateHeader(request, response, config, nOnce);
          response.send();
          // hres.flushBuffer();
          return (false);
      }
docs: Authenticate the user making this request, based on the specified login configuration. Return <code>true</code> if any
  specified constraint has been satisfied, or <code>false</code> if we have created a response challenge already.
  
  @param request Request we are processing
  @param response Response we are creating
  @param config Login configuration describing how authentication should be performed
  @param securityDomain
  @param deployment
  @param servletInfo
  @param sipStack
  
  @exception IOException if an input/output error occurs