code: protected final boolean authenticate(Context context, String username, String password, boolean rememberMe) {
          UsernamePasswordToken authenticationToken = new UsernamePasswordToken(username, password, rememberMe);
          try {
              SecurityUtils.getSubject().login(authenticationToken);
              log.info("'{}' authenticated", username);
              return true;
          } catch (AuthenticationException e) {
              log.info("'{}' failed to authenticate", username);
              return false;
          }
      }
docs: Authenticate the supplied credentials and setup the Context.
  
  @param context
  @param username
  @param password
  @param rememberMe
  @return true if the authentication is successful