그런 오래된 스레드로 작성해 주셔서 죄송합니다. 누군가의 시간을 절약 할 수 있다고 생각했습니다.
이 솔루션은 기본 인증 용입니다. 나는 이것을 digest auth로 테스트하지 않았다.
.htaccess를 작동 시키려면 @ Tan의 대답을 약간 조정해야합니다.
내가
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
에서
[L]
를 제거하고 단지
RewriteEngine on
htaccess로 파일 후 재 작성 규칙을 배치 :
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#Other rules follow
다음으로, 응용 프로그램/설정 내부 rest.php 설정 파일을 변경하는 데 필요한 예배 규칙서. 다음과 같이 내가 만든 변경 사항은 다음과 같습니다
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Api_auth
{
public function login($username, $password) {
if($username == 'admin' && $password == '1234')
{
return true;
}
else
{
return false;
}
}
}
:
$config['auth_source'] = 'ldap'
$config['auth_library_class'] = ''
$config['auth_library_function'] = ''
다음
$config['auth_library_function'] = 'login'
-$config['auth_library_class'] = 'api_auth'
에, $config['auth_source'] = 'library'
에, 나는 다음과 같은 코드를 가진 Api_auth.php라는 새로운 라이브러리 파일을 생성
언젠가 누군가에게 도움이되기를 바랍니다.