小编Uwe*_*Uwe的帖子

Apache mod_auth_form如何锁定文件夹

在我看来,我有一个根本的误解,"mod_auth_form"应该如何工作.我参考Apache文档的这个页面:

http://httpd.apache.org/docs/current/mod/mod_auth_form.html
Run Code Online (Sandbox Code Playgroud)

我有一个公用文件夹和一个私人文件夹

我想要实现的是文件夹被锁定.用户需要使用他们的用户名和密码登录才能看到我的受保护文件夹的index.php页面.

这是我的虚拟主机设置:

<VirtualHost  *:80>
    ServerName customform.uwe
    DocumentRoot "/home/uwe/www/protected_custom_form"
    DirectoryIndex index.php
    ErrorLog /var/log/apache2/protected_custom_form.error.log
    CustomLog /var/log/apache2/protected_custom_form.access.log combined

    <Directory "/home/uwe/www/protected_custom_form">
        AllowOverride All
        Allow from All
    </Directory>

    <Directory "/home/uwe/www/protected_custom_form/secret/">

    </Directory>

    <Location /dologin>
        SetHandler form-login-handler
        AuthFormLoginRequiredLocation http://customform.uwe/login.html
        AuthFormProvider file
        AuthUserFile /home/uwe/www/conf/passwd
        AuthType form
        AuthName realm
        Session On
        SessionCookieName session path=/
        SessionCryptoPassphrase secret
    </Location>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

这是我的登录表单,它位于我的虚拟服务器的公共文件夹中:

<form method="POST" action="/dologin">
    Username: <input type="text" name="httpd_username" value="" />
    Password: <input type="password" name="httpd_password" value="" />
    <input type="submit" name="login" value="Login" />
    <input type="hidden" name="httpd_location" value="http://customform.uwe/secret/index.php" />
</form>
Run Code Online (Sandbox Code Playgroud)

好的,这是发生的事情 …

apache authentication

5
推荐指数
0
解决办法
4506
查看次数

Angular4如何启用测试覆盖率

我正在开发一个Angular4项目.

我正在尝试设置代码覆盖率.我创建了一个非常简单的小应用程序.

我读了我能找到的每一个可能的页面,但我迷失了.

如何在Angular4中设置代码覆盖率?

更新2: 我现在决定使用业力报道报道 https://www.npmjs.com/package/karma-coverage ,因此根据描述重写了业力配置文件.

包json更新到了.

我现在看到正在生成的文件夹,但HTML文件显示一个空表, 在此输入图像描述

测试正在运行并通过:

在此输入图像描述 不知道该怎么做.

这是我的包json.

   {
  "name": "angular2-webpack",
  "version": "0.0.1",
  "description": "A webpack starter for Angular",
  "scripts": {
      "pretest": "npm run lint",
      "start": "webpack-dev-server --inline --progress --port 8080",
      "test": "karma start",
      "build": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail",
      "lint": "tslint --force \"src/**/*.ts\""
  },
  "license": "MIT",
    "dependencies": {
        "@angular/common": "4.1.2",
        "@angular/compiler": "4.1.2",
        "@angular/core": "4.1.2",
        "@angular/forms": "4.1.2",
        "@angular/http": "4.1.2",
        "@angular/platform-browser": "4.1.2",
        "@angular/platform-browser-dynamic": "4.1.2",
        "@angular/router": "4.1.2",
        "bootstrap": "^3.3.7",
        "core-js": "2.4.1", …
Run Code Online (Sandbox Code Playgroud)

karma-runner karma-coverage angular

5
推荐指数
1
解决办法
6829
查看次数

将 JS 转换为 TypeScript:类型“CSSRule”上不存在属性“selectorText”

我正在尝试将我在这里找到的一些 JS 转换为 Typescript

http://bl.ocks.org/Rokotyan/0556f8facbaf344507cdc45dc3622177

部分问题在于这段代码

// Extract CSS Rules
    var extractedCSSText = "";
    for (var i = 0; i < document.styleSheets.length; i++) {
        var s = document.styleSheets[i];

        try {
            if(!s.cssRules) continue;
        } catch( e ) {
                if(e.name !== 'SecurityError') throw e; // for Firefox
                continue;
            }

        var cssRules = s.cssRules;
        for (var r = 0; r < cssRules.length; r++) {
            if ( contains( cssRules[r].selectorText, selectorTextArr ) )
                extractedCSSText += cssRules[r].cssText;
        }
    }
Run Code Online (Sandbox Code Playgroud)

我尝试以这种方式将其转换为 Typescript:

// Extract CSS Rules
let …
Run Code Online (Sandbox Code Playgroud)

javascript typescript

5
推荐指数
1
解决办法
3183
查看次数

PHP 5.3.5 ldap_search():搜索:无法联系LDAP服务器

我有一个LDAP PHP类,适用于我们公司的所有其他PHP安装.但是,代码现在停止工作,我从SuSE更改为Ubuntu 11.04.PHP版本是5.3.5.

我尝试连接到我们的LDAP服务器.连接到它后,我尝试运行ldap_search.它失败并显示错误消息'ldap_search():搜索:无法联系LDAP服务器'.我使用wireshark查看了流量,可以看到php和ldap之间发生的通信,唉没有连接发生.

Uwe,谢谢你的想法

这是我使用的代码:

class ldap{
    private $ldap_conn;
    private $ldaphost;
    private $ldapport;

    public function __construct ()
    {
      $this->ldaphost = 'ldaps://ourserver.co.nz';  // obviously a fake name 
      $this->ldapport = 636;
      $this->ldap_conn = ldap_connect($this->ldaphost, $this->ldapport) or die("Could not connect to $this->ldaphost");
    }

    public function signin ($username,$password, $applicationName)
    {
        $dn = "o=MY_COM";
        $filter="(cn=$username)";

        $justthese = array("dn","fullname", "mail");

        $sr=ldap_search($this->ldap_conn, $dn, $filter, $justthese);

        $people = ldap_get_entries($this->ldapconn, $sr);

        if (!$people || count($people) == 0 || $people['count'] == 0)
        {  //Nothing found, quit.
            return AUTH_ERROR_NO_DN;
        } …
Run Code Online (Sandbox Code Playgroud)

php ubuntu ldap

4
推荐指数
1
解决办法
4357
查看次数